UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
anonymous_namespace{httpreadwrite.cpp} Namespace Reference

Classes

struct  http_connection_handle_t
 Handle for a connection. More...
 

Functions

Scope restricted to file
int Check_Connect_And_Wait_Connection (const SOCKET a_sock, const int connect_res)
 Checks socket connection and wait if it is not connected.
 
int get_hoststr (const char *url_str, const char **hoststr, size_t *hostlen)
 Point to the hostname within a URL C-string.
 
void copy_msg_headers (LinkedList *msgHeaders, UpnpString *headers)
 Dummy function. It do nothing since years. Do we need it?
 
int MakeGenericMessage (http_method_t method, const char *url_str, membuffer *request, uri_type *url, int contentLength, const char *contentType, const UpnpString *headers)
 Make a generic message, what ever this mean.
 
int ReadResponseLineAndHeaders (SOCKINFO *info, http_parser_t *parser, int *timeout_secs, int *http_error_code)
 Parses already exiting data.
 
int MakeGetMessageEx (const char *url_str, membuffer *request, uri_type *url, SendInstruction *pRangeSpecifier)
 Make extended GetMessage.
 

Variables

constexpr size_t CHUNK_HEADER_SIZE {10}
 ???
 
constexpr size_t CHUNK_TAIL_SIZE {10}
 ???
 
constexpr time_t DEFAULT_TCP_CONNECT_TIMEOUT {5}
 Default TCP connection timeout.
 

Class Documentation

◆ anonymous_namespace{httpreadwrite.cpp}::http_connection_handle_t

struct anonymous_namespace{httpreadwrite.cpp}::http_connection_handle_t

Handle for a connection.

Definition at line 317 of file httpreadwrite.cpp.

+ Collaboration diagram for anonymous_namespace{httpreadwrite.cpp}::http_connection_handle_t:
Class Members
SOCKINFO sock_info
int contentLength
http_parser_t response
int requestStarted
int cancel

Function Documentation

◆ Check_Connect_And_Wait_Connection()

int anonymous_namespace{httpreadwrite.cpp}::Check_Connect_And_Wait_Connection ( const SOCKET  a_sock,
const int  connect_res 
)

Checks socket connection and wait if it is not connected.

It should be called just after connect.

Returns
0 if successful, else -1.
Parameters
[in]a_sockSocket file descriptor.
[in]connect_resResult of connect that has been executed before calling this.

Definition at line 108 of file httpreadwrite.cpp.

+ Here is the caller graph for this function:

◆ get_hoststr()

int anonymous_namespace{httpreadwrite.cpp}::get_hoststr ( const char *  url_str,
const char **  hoststr,
size_t *  hostlen 
)

Point to the hostname within a URL C-string.

Returns
On success: UPNP_E_SUCCESS
On error: UPNP_E_INVALID_URL
Todo:
Check if this can be taken from the httpparser.
Parameters
[in]url_strPointer to URL string.
[out]hoststrFilled with a pointer to the start of the host string within url_str. On error this remains untouched.
[out]hostlenFilled with the length (without terminating '\0') of the host string. On error this remains untouched.

Definition at line 175 of file httpreadwrite.cpp.

+ Here is the caller graph for this function:

◆ copy_msg_headers()

void anonymous_namespace{httpreadwrite.cpp}::copy_msg_headers ( LinkedList msgHeaders,
UpnpString headers 
)

Dummy function. It do nothing since years. Do we need it?

Todo:
Dummy function. It do nothing since years. Do we need it?

Definition at line 217 of file httpreadwrite.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeGenericMessage()

int anonymous_namespace{httpreadwrite.cpp}::MakeGenericMessage ( http_method_t  method,
const char *  url_str,
membuffer request,
uri_type url,
int  contentLength,
const char *  contentType,
const UpnpString headers 
)

Make a generic message, what ever this mean.

Todo:
Need to be documented.

Definition at line 250 of file httpreadwrite.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadResponseLineAndHeaders()

int anonymous_namespace{httpreadwrite.cpp}::ReadResponseLineAndHeaders ( SOCKINFO info,
http_parser_t parser,
int *  timeout_secs,
int *  http_error_code 
)

Parses already exiting data.

If not complete reads more data on the connected socket. The read data is then parsed. The same methid is carried out for headers.

Returns
On success: PARSE_OK
On error:
  • PARSE_FAILURE - Failure to parse data correctly
  • UPNP_E_BAD_HTTPMSG - Socker read() returns an error
Parameters
infoSocket information object.
parserHTTP Parser object.
timeout_secsTime out value.
http_error_codeHTTP errror code returned.

Definition at line 337 of file httpreadwrite.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeGetMessageEx()

int anonymous_namespace{httpreadwrite.cpp}::MakeGetMessageEx ( const char *  url_str,
membuffer request,
uri_type url,
SendInstruction pRangeSpecifier 
)

Make extended GetMessage.

Todo:
Needs documentation. There was no information found.

Definition at line 444 of file httpreadwrite.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ CHUNK_HEADER_SIZE

constexpr size_t anonymous_namespace{httpreadwrite.cpp}::CHUNK_HEADER_SIZE {10}
constexpr

???

Definition at line 83 of file httpreadwrite.cpp.

◆ CHUNK_TAIL_SIZE

constexpr size_t anonymous_namespace{httpreadwrite.cpp}::CHUNK_TAIL_SIZE {10}
constexpr

???

Definition at line 85 of file httpreadwrite.cpp.

◆ DEFAULT_TCP_CONNECT_TIMEOUT

constexpr time_t anonymous_namespace{httpreadwrite.cpp}::DEFAULT_TCP_CONNECT_TIMEOUT {5}
constexpr

Default TCP connection timeout.

Definition at line 90 of file httpreadwrite.cpp.