32 #ifndef GENLIB_NET_URI_H 33 #define GENLIB_NET_URI_H 40 #include <sys/param.h> 51 #include <sys/types.h> 55 #ifndef UPNP_USE_MSVCPP 57 #include "inet_pton.h" 64 #define strncasecmp strnicmp 74 #define HTTP_DATE_LENGTH 37 76 #define SEPARATORS "()<>@,;:\\\"/[]?={} \t" 77 #define MARK "-_.!~*'()" 80 #define RESERVED ";/?:@&=+$,{}" 82 #define HTTP_SUCCESS 1 87 #define SOCKET_BUFFER_SIZE 5000 130 struct sockaddr_storage IPaddress;
139 enum pathType path_type;
142 hostport_type hostport;
394 #define HTTP_E_BAD_URL UPNP_E_INVALID_URL 395 #define HTTP_E_READ_SOCKET UPNP_E_SOCKET_READ 396 #define HTTP_E_BIND_SOCKET UPNP_E_SOCKET_BIND 397 #define HTTP_E_WRITE_SOCKET UPNP_E_SOCKET_WRITE 398 #define HTTP_E_CONNECT_SOCKET UPNP_E_SOCKET_CONNECT 399 #define HTTP_E_SOCKET UPNP_E_OUTOF_SOCKET 400 #define HTTP_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE 401 #define HTTP_E_BAD_REQUEST UPNP_E_BAD_REQUEST 402 #define HTTP_E_BAD_IP_ADDRESS UPNP_E_INVALID_URL 404 #define RESPONSE_TIMEOUT 30 412 typedef struct SOCKET_BUFFER{
413 char buff[SOCKET_BUFFER_SIZE];
415 struct SOCKET_BUFFER *next;
419 typedef struct HTTP_HEADER {
422 struct HTTP_HEADER * next;
426 typedef struct HTTP_STATUS_LINE{
433 typedef struct HTTP_REQUEST_LINE {
443 typedef struct HTTP_MESSAGE {
445 http_request request;
446 http_header * header_list;
471 int transferHTTPparsedURL(
484 void currentTmToHttpDate(
488 int parse_http_response(
494 int parse_http_request(
500 void print_http_message(
501 http_message *message);
504 int search_for_header(
510 void print_status_line(
514 void print_request_line(
541 void free_http_message(
542 http_message *message);
int copy_URL_list(URL_list *in, URL_list *out)
Copies one URL_list into another.
Definition: uri.c:214
char * URLs
Definition: uri.h:153
Represents a host port: e.g. "127.127.0.1:80" text is a token pointing to the full string representat...
Definition: uri.h:126
Represents a URI used in parse_uri and elsewhere.
Definition: uri.h:136
int parse_uri(const char *in, size_t max, uri_type *out)
Parses a uri as defined in http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs).
Definition: uri.c:706
int remove_dots(char *in, size_t size)
Removes ".", and ".." from a path.
Definition: uri.c:526
int parse_uri_and_unescape(char *in, size_t max, uri_type *out)
Same as parse_uri(), except that all strings are unescaped (XX replaced by chars).
Definition: uri.c:753
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA. "char *" URLs holds dynamic memory.
Definition: uri.h:149
int token_string_cmp(token *in1, char *in2)
Compares a null terminated string to a token (exact).
Definition: uri.c:299
void print_uri(uri_type *in)
Function useful in debugging for printing a parsed uri.
Definition: uri.c:265
token text
Definition: uri.h:128
struct TOKEN token
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
Provides a platform independent way to include TCP/IP types and functions.
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
Definition: uri.h:117
struct URI uri_type
Represents a URI used in parse_uri and elsewhere.
int token_cmp(token *in1, token *in2)
Compares two tokens.
Definition: uri.c:308
struct HOSTPORT hostport_type
Represents a host port: e.g. "127.127.0.1:80" text is a token pointing to the full string representat...
void print_token(token *in)
Function useful in debugging for printing a token.
Definition: uri.c:276
char * resolve_rel_url(char *base_url, char *rel_url)
resolves a relative url with a base url returning a NEW (dynamically allocated with malloc) full url...
Definition: uri.c:592
int replace_escaped(char *in, size_t index, size_t *max)
Replaces an escaped sequence with its unescaped version as in http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs)
Definition: uri.c:135
int token_string_casecmp(token *in1, const char *in2)
Compares buffer in the token object with the buffer in in2.
Definition: uri.c:289
int parse_token(char *in, token *out, int max_size)
struct URL_LIST URL_list
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA. "char *" URLs holds dynamic memory.
#define UPNP_INLINE
Declares an inline function.
Definition: UpnpGlobal.h:93
Defines constants that for some reason are not defined on some systems.
void free_URL_list(URL_list *list)
Frees the memory associated with a URL_list.
Definition: uri.c:252
int remove_escaped_chars(char *in, size_t *size)
Removes http escaped characters such as: "%20" and replaces them with their character representation...