32#ifndef GENLIB_NET_URI_H
33#define GENLIB_NET_URI_H
40 #include <sys/param.h>
55 #if !defined(UPNP_USE_MSVCPP) && !defined(UPNP_USE_BCBPP)
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 ";/?:@&=+$,{}"
87#define SOCKET_BUFFER_SIZE 5000
130 struct sockaddr_storage IPaddress;
139 enum pathType path_type;
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
412typedef struct SOCKET_BUFFER{
413 char buff[SOCKET_BUFFER_SIZE];
415 struct SOCKET_BUFFER *next;
419typedef struct HTTP_HEADER {
422 struct HTTP_HEADER * next;
426typedef struct HTTP_STATUS_LINE{
433typedef struct HTTP_REQUEST_LINE {
443typedef struct HTTP_MESSAGE {
445 http_request request;
446 http_header * header_list;
471int transferHTTPparsedURL(
484void currentTmToHttpDate(
488int parse_http_response(
494int parse_http_request(
500void print_http_message(
501 http_message *message);
504int search_for_header(
510void print_status_line(
514void print_request_line(
541void free_http_message(
542 http_message *message);
Defines constants that for some reason are not defined on some systems.
#define UPNP_INLINE
Declares an inline function.
Definition: UpnpGlobal.h:99
Provides a platform independent way to include TCP/IP types and functions.
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
token text
Definition: uri.h:128
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
Definition: uri.h:117
Represents a URI used in parse_uri and elsewhere.
Definition: uri.h:136
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA....
Definition: uri.h:149
char * URLs
Definition: uri.h:153
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:593
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....
int token_string_cmp(token *in1, char *in2)
Compares a null terminated string to a token (exact).
Definition: uri.c:299
int copy_URL_list(URL_list *in, URL_list *out)
Copies one URL_list into another.
Definition: uri.c:214
struct TOKEN token
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
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....
Definition: uri.c:135
int remove_dots(char *in, size_t size)
Removes ".", and ".." from a path.
Definition: uri.c:527
int token_cmp(token *in1, token *in2)
Compares two tokens.
Definition: uri.c:308
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:759
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...
int token_string_casecmp(token *in1, const char *in2)
Compares buffer in the token object with the buffer in in2.
Definition: uri.c:289
struct URI uri_type
Represents a URI used in parse_uri and elsewhere.
int remove_escaped_chars(char *in, size_t *size)
Removes http escaped characters such as: "%20" and replaces them with their character representation....
void print_uri(uri_type *in)
Function useful in debugging for printing a parsed uri.
Definition: uri.c:265
void print_token(token *in)
Function useful in debugging for printing a token.
Definition: uri.c:276
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:707
void free_URL_list(URL_list *list)
Frees the memory associated with a URL_list.
Definition: uri.c:252