/home/dko/Projects/mobilec/src/mtp_http.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include "config.h"
#include "include/connection.h"
#include "include/mtp_http.h"
#include "include/macros.h"
#include "include/mc_error.h"
#include "include/message.h"
#include "include/dynstring.h"

Go to the source code of this file.

Defines

#define SAFE_FREE(elem)
#define HTTP_PARSE_EXPR(parse_name, struct_name)
#define SAFE_FREE(object)

Functions

int mtp_http_Destroy (mtp_http_p http)
mtp_http_p mtp_http_New (void)
int rece_de_msg (char *buffer, connection_p con, char *privatekey)
int mtp_http_InitializeFromConnection (mtp_http_p http, connection_p connection, char *privatekey)
const char * http_GetExpression (const char *string, char **expr)
 Parse an html expression.
int http_ParseExpression (const char *expression_string, char **name, char **value)
 Parse an expression into its name and value.
const char * mtp_http_ParseHeader (struct mtp_http_s *http, const char *string)
int mtp_http_Parse (struct mtp_http_s *http, const char *string)
const char * http_ParseRequest (mtp_http_p http, const char *string)
const char * http_GetToken (const char *string, char **token)
int mtp_http_ParseResponse (struct mtp_http_s *http, const char *string)
int mtp_http_ComposeMessage (message_p message)
struct message_smtp_http_CreateMessage (mtp_http_t *mtp_http, char *hostname, int port)

Define Documentation

#define HTTP_PARSE_EXPR ( parse_name,
struct_name   ) 
Value:
if ( !strcmp(name, parse_name) ) { \
      http->struct_name = (char*)malloc \
      ( \
        sizeof(char) * \
        (strlen(value)+1) \
      ); \
      strcpy(http->struct_name, value); \
    } else

Referenced by mtp_http_ParseHeader().

#define SAFE_FREE ( object   ) 
Value:
if(object) free(object); \
    object = NULL
#define SAFE_FREE ( elem   ) 
Value:
if(elem) \
    free(elem)

Referenced by mtp_http_Destroy(), and mtp_http_ParseHeader().


Function Documentation

const char* http_GetExpression ( const char *  string,
char **  expr 
)

Parse an html expression.

Parameters:
string (input) The html block of text: Will parse the first expression pointed to by 'string'.
expr (output) The allocated expression
Returns:
A pointer to the next expression segment of the string block, or NULL.

Definition at line 349 of file mtp_http.c.

Referenced by mtp_http_Parse(), and mtp_http_ParseHeader().

const char* http_GetToken ( const char *  string,
char **  token 
)

Definition at line 790 of file mtp_http.c.

References cur.

Referenced by http_ParseRequest().

int http_ParseExpression ( const char *  expression_string,
char **  name,
char **  value 
)

Parse an expression into its name and value.

Parameters:
expression_string (input) The expression
name (output) An allocated name string or NULL
value (output) An allocated value string or NULL
Returns:
error_code_t type
Note:
an http expression is something like 'Date: Mon, 23 May 2005 22:38:34 GMT
' where 'Date' is the name and the remainder of the string is the value

Definition at line 408 of file mtp_http.c.

References CHECK_NULL, MC_ERR_PARSE, and MC_SUCCESS.

Referenced by mtp_http_Parse(), and mtp_http_ParseHeader().

const char* http_ParseRequest ( mtp_http_p  http,
const char *  string 
)
int mtp_http_ComposeMessage ( message_p  message  ) 
struct message_s* mtp_http_CreateMessage ( mtp_http_t mtp_http,
char *  hostname,
int  port 
) [read]
int mtp_http_Destroy ( mtp_http_p  http  ) 
int mtp_http_InitializeFromConnection ( mtp_http_p  http,
connection_p  connection,
char *  privatekey 
)
mtp_http_p mtp_http_New ( void   ) 
int mtp_http_Parse ( struct mtp_http_s http,
const char *  string 
)
const char* mtp_http_ParseHeader ( struct mtp_http_s http,
const char *  string 
)
int mtp_http_ParseResponse ( struct mtp_http_s http,
const char *  string 
)

Definition at line 823 of file mtp_http.c.

int rece_de_msg ( char *  buffer,
connection_p  con,
char *  privatekey 
)
Generated on Tue Dec 28 15:15:28 2010 for Mobile-C by  doxygen 1.6.3