http_client.h File Reference

#include "genlib/closesocket/upnpclosesocket.h"
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/time.h>
#include "tools/config.h"
#include "upnp.h"

Go to the source code of this file.

Data Structures

struct  SOCKET_BUFFER
struct  TOKEN
struct  HOSTPORT
struct  URI
struct  URL_LIST
struct  HTTP_HEADER
struct  HTTP_STATUS_LINE
struct  HTTP_REQUEST_LINE
struct  HTTP_MESSAGE

Defines

#define EXTERN_C
#define HTTP_DATE_LENGTH   37
#define SEPARATORS   "()<>@,;:\\\"/[]?={} \t"
#define MARK   "-_.!~*'()"
#define RESERVED   ";/?:@&=+$,"
#define HTTP_SUCCESS   1
#define HTTP_E_BAD_URL   UPNP_E_INVALID_URL
#define HTTP_E_READ_SOCKET   UPNP_E_SOCKET_READ
#define HTTP_E_BIND_SOCKET   UPNP_E_SOCKET_BIND
#define HTTP_E_WRITE_SOCKET   UPNP_E_SOCKET_WRITE
#define HTTP_E_CONNECT_SOCKET   UPNP_E_SOCKET_CONNECT
#define HTTP_E_SOCKET   UPNP_E_OUTOF_SOCKET
#define HTTP_E_BAD_RESPONSE   UPNP_E_BAD_RESPONSE
#define HTTP_E_BAD_REQUEST   UPNP_E_BAD_REQUEST
#define HTTP_E_BAD_IP_ADDRESS   UPNP_E_INVALID_URL
#define FALSE   0
#define TAB   9
#define CR   13
#define LF   10
#define RESPONSE_TIMEOUT   30
#define SOCKET_BUFFER_SIZE   5000

Typedefs

typedef struct SOCKET_BUFFER socket_buffer
typedef struct TOKEN token
typedef struct HOSTPORT hostport_type
typedef struct URI uri_type
typedef struct URL_LIST URL_list
typedef struct HTTP_HEADER http_header
typedef struct HTTP_STATUS_LINE http_status
typedef struct HTTP_REQUEST_LINE http_request
typedef struct HTTP_MESSAGE http_message

Enumerations

enum  hostType { HOSTNAME, IPv4address, HOSTNAME, IPv4address }
enum  pathType {
  ABS_PATH, REL_PATH, OPAQUE_PART, ABS_PATH,
  REL_PATH, OPAQUE_PART
}
enum  uriType { ABSOLUTE, RELATIVE, ABSOLUTE, RELATIVE }

Functions

EXTERN_C int transferHTTP (char *request, char *toSend, int toSendSize, char **out, char *Url)
EXTERN_C int transferHTTPRaw (char *toSend, int toSendSize, char **out, char *URL)
EXTERN_C int transferHTTPparsedURL (char *request, char *toSend, int toSendSize, char **out, uri_type *URL)
EXTERN_C void currentTmToHttpDate (char *out)
EXTERN_C char * resolve_rel_url (char *base_url, char *rel_url)
EXTERN_C int parse_uri (char *in, int max, uri_type *out)
EXTERN_C int token_cmp (token *in1, token *in2)
EXTERN_C int token_string_casecmp (token *in1, char *in2)
EXTERN_C int token_string_cmp (token *in1, char *in2)
EXTERN_C int parse_http_response (char *in, http_message *out, int max_len)
EXTERN_C int parse_http_request (char *in, http_message *out, int max_len)
EXTERN_C int search_for_header (http_message *in, char *header, token *out_value)
EXTERN_C int parse_hostport (char *in, int max, hostport_type *out)
EXTERN_C size_t write_bytes (int fd, char *bytes, size_t n, int timeout)
EXTERN_C void free_http_message (http_message *message)
EXTERN_C int copy_URL_list (URL_list *in, URL_list *out)
EXTERN_C void free_URL_list (URL_list *list)
EXTERN_C int parse_port (int max, char *port, unsigned short int *out)
EXTERN_C int parse_http_line (char *in, int max_size)
EXTERN_C int parse_not_LWS (char *in, token *out, int max_size)
EXTERN_C int parse_LWS (char *in, int max_size)
EXTERN_C int parse_token (char *in, token *out, int max_size)
EXTERN_C ssize_t readLine (int fd, char *out, int max, int *timeout)
EXTERN_C int remove_dots (char *in, int size)
 DBGONLY (EXTERN_C void print_http_request(http_message *message, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);)
 DBGONLY (EXTERN_C void print_http_response(http_message *message, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);)
 DBGONLY (EXTERN_C void print_token(token *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);)
 DBGONLY (EXTERN_C void print_status_line(http_status *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);)
 DBGONLY (EXTERN_C void print_request_line(http_request *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo))
 DBGONLY (EXTERN_C void print_uri(uri_type *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);)

Define Documentation

#define CR   13

Definition at line 74 of file http_client.h.

#define EXTERN_C

Definition at line 37 of file http_client.h.

#define FALSE   0

Definition at line 72 of file http_client.h.

#define HTTP_DATE_LENGTH   37

Definition at line 57 of file http_client.h.

#define HTTP_E_BAD_IP_ADDRESS   UPNP_E_INVALID_URL

Definition at line 71 of file http_client.h.

#define HTTP_E_BAD_REQUEST   UPNP_E_BAD_REQUEST

Definition at line 70 of file http_client.h.

#define HTTP_E_BAD_RESPONSE   UPNP_E_BAD_RESPONSE

Definition at line 69 of file http_client.h.

#define HTTP_E_BAD_URL   UPNP_E_INVALID_URL

Definition at line 63 of file http_client.h.

#define HTTP_E_BIND_SOCKET   UPNP_E_SOCKET_BIND

Definition at line 65 of file http_client.h.

#define HTTP_E_CONNECT_SOCKET   UPNP_E_SOCKET_CONNECT

Definition at line 67 of file http_client.h.

#define HTTP_E_READ_SOCKET   UPNP_E_SOCKET_READ

Definition at line 64 of file http_client.h.

#define HTTP_E_SOCKET   UPNP_E_OUTOF_SOCKET

Definition at line 68 of file http_client.h.

#define HTTP_E_WRITE_SOCKET   UPNP_E_SOCKET_WRITE

Definition at line 66 of file http_client.h.

#define HTTP_SUCCESS   1

Definition at line 62 of file http_client.h.

#define LF   10

Definition at line 75 of file http_client.h.

#define MARK   "-_.!~*'()"

Definition at line 60 of file http_client.h.

#define RESERVED   ";/?:@&=+$,"

Definition at line 61 of file http_client.h.

#define RESPONSE_TIMEOUT   30

Definition at line 76 of file http_client.h.

#define SEPARATORS   "()<>@,;:\\\"/[]?={} \t"

Definition at line 59 of file http_client.h.

#define SOCKET_BUFFER_SIZE   5000

Definition at line 77 of file http_client.h.

#define TAB   9

Definition at line 73 of file http_client.h.


Typedef Documentation

typedef struct HOSTPORT hostport_type
typedef struct HTTP_HEADER http_header
typedef struct HTTP_MESSAGE http_message
typedef struct HTTP_STATUS_LINE http_status
typedef struct SOCKET_BUFFER socket_buffer
typedef struct TOKEN token
typedef struct URI uri_type
typedef struct URL_LIST URL_list

Enumeration Type Documentation

enum hostType
Enumerator:
HOSTNAME 
IPv4address 
HOSTNAME 
IPv4address 

Definition at line 79 of file http_client.h.

enum pathType
Enumerator:
ABS_PATH 
REL_PATH 
OPAQUE_PART 
ABS_PATH 
REL_PATH 
OPAQUE_PART 

Definition at line 80 of file http_client.h.

enum uriType
Enumerator:
ABSOLUTE 
RELATIVE 
ABSOLUTE 
RELATIVE 

Definition at line 81 of file http_client.h.


Function Documentation

EXTERN_C int copy_URL_list ( URL_list in,
URL_list out 
)
EXTERN_C void currentTmToHttpDate ( char *  out  ) 
DBGONLY ( EXTERN_C void print_uri(uri_type *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);   ) 
DBGONLY ( EXTERN_C void   print_request_linehttp_request *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo  ) 
DBGONLY ( EXTERN_C void print_status_line(http_status *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);   ) 
DBGONLY ( EXTERN_C void print_token(token *in, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);   ) 
DBGONLY ( EXTERN_C void print_http_response(http_message *message, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);   ) 
DBGONLY ( EXTERN_C void print_http_request(http_message *message, Dbg_Level DLevel, Dbg_Module Module, char *DbgFileName, int DbgLineNo);   ) 
EXTERN_C void free_http_message ( http_message message  ) 
EXTERN_C void free_URL_list ( URL_list list  ) 
EXTERN_C int parse_hostport ( char *  in,
int  max,
hostport_type out 
)
EXTERN_C int parse_http_line ( char *  in,
int  max_size 
)
EXTERN_C int parse_http_request ( char *  in,
http_message out,
int  max_len 
)
EXTERN_C int parse_http_response ( char *  in,
http_message out,
int  max_len 
)
EXTERN_C int parse_LWS ( char *  in,
int  max_size 
)
EXTERN_C int parse_not_LWS ( char *  in,
token out,
int  max_size 
)
EXTERN_C int parse_port ( int  max,
char *  port,
unsigned short int *  out 
)
EXTERN_C int parse_token ( char *  in,
token out,
int  max_size 
)
EXTERN_C int parse_uri ( char *  in,
int  max,
uri_type out 
)
EXTERN_C ssize_t readLine ( int  fd,
char *  out,
int  max,
int *  timeout 
)
EXTERN_C int remove_dots ( char *  in,
int  size 
)
EXTERN_C char* resolve_rel_url ( char *  base_url,
char *  rel_url 
)
EXTERN_C int search_for_header ( http_message in,
char *  header,
token out_value 
)
EXTERN_C int token_cmp ( token in1,
token in2 
)
EXTERN_C int token_string_casecmp ( token in1,
char *  in2 
)
EXTERN_C int token_string_cmp ( token in1,
char *  in2 
)
EXTERN_C int transferHTTP ( char *  request,
char *  toSend,
int  toSendSize,
char **  out,
char *  Url 
)
EXTERN_C int transferHTTPparsedURL ( char *  request,
char *  toSend,
int  toSendSize,
char **  out,
uri_type URL 
)
EXTERN_C int transferHTTPRaw ( char *  toSend,
int  toSendSize,
char **  out,
char *  URL 
)
EXTERN_C size_t write_bytes ( int  fd,
char *  bytes,
size_t  n,
int  timeout 
)

Generated on Fri Mar 26 20:16:54 2010 for MediaTomb by  doxygen 1.6.1