Classes | |
| struct | CXmlAlias |
| Alias directory structure on the webserver for an XML document. More... | |
Enumerations | |
| enum | resp_type { RESP_UNSPEC , RESP_FILEDOC , RESP_XMLDOC , RESP_HEADERS , RESP_WEBDOC , RESP_POST } |
| Response types. More... | |
Functions | |
Scope restricted to file | |
| char * | web_server_asctime_r (const struct tm *tm, char *buf) |
| Multiplatform wrapper to make win32 asctime_s compatible to posix asctime_r. | |
| int | search_extension (const char *a_extension, const char **a_con_type, const char **a_con_subtype) |
| Based on the extension, returns the content type and content subtype. | |
| int | get_content_type (const char *filename, UpnpFileInfo *fileInfo) |
Based on the extension of the filename, clones an XML string based on type and content subtype. | |
| int | get_file_info (const char *filename, UpnpFileInfo *info) |
| Get file information. | |
| int | get_alias (const char *request_file, CXmlAlias *alias, UpnpFileInfo *info) |
| Compare file names. | |
| int | isFileInVirtualDir (char *filePath, const void **cookie) |
| Compares filePath with paths from the list of virtual directory lists. | |
| void | ToUpperCase (char *s) |
| Converts C string in place to upper case. | |
| char * | StrStr (char *s1, const char *s2) |
| Finds a substring from a string in a case insensitive way. | |
| char * | StrTok (char **Src, const char *Del) |
| Finds next token in a string. | |
| int | GetNextRange (char **SrcRangeStr, off_t *FirstByte, off_t *LastByte) |
| Returns a range of integers from a string. | |
| int | CreateHTTPRangeResponseHeader (char *ByteRangeSpecifier, off_t FileLength, struct SendInstruction *Instr) |
| Fills in the Offset, read size and contents to send out as an HTTP Range Response. | |
| int | CheckOtherHTTPHeaders (http_message_t *Req, struct SendInstruction *RespInstr, off_t FileSize) |
| Get header id from the request parameter. | |
| void | FreeExtraHTTPHeaders (UpnpListHead *extraHeadersList) |
| Free extra HTTP headers. | |
| int | ExtraHTTPHeaders (http_message_t *Req, UpnpListHead *extraHeadersList) |
| Build an array of unrecognized headers. | |
| int | process_request_in (SOCKINFO *info, http_message_t *req, enum resp_type *rtype, membuffer *headers, membuffer *filename, CXmlAlias *a_alias, SendInstruction *RespInstr) |
| Process a remote request and return the result. | |
| int | http_RecvPostMessage (http_parser_t *parser, SOCKINFO *info, char *filename, struct SendInstruction *Instr) |
| Receives the HTTP post message. | |
Variables | |
| const char * | gMediaTypes [] |
| Media types. | |
| constexpr size_t | APPLICATION_INDEX {4} |
| index to get media type of application from the media types table. | |
| constexpr size_t | ASCTIME_R_BUFFER_SIZE {26} |
| Number of elements for asctime_s on win32, means buffer size. | |
| CXmlAlias | gAliasDoc |
| Global XML document object. | |
| enum compa::anonymous_namespace{webserver.cpp}::resp_type |
Response types.
| Enumerator | |
|---|---|
| RESP_UNSPEC |
|
| RESP_FILEDOC |
|
| RESP_XMLDOC |
|
| RESP_HEADERS |
|
| RESP_WEBDOC |
|
| RESP_POST |
|
Definition at line 71 of file webserver.cpp.
| char * compa::anonymous_namespace{webserver.cpp}::web_server_asctime_r | ( | const struct tm * | tm, |
| char * | buf | ||
| ) |
Multiplatform wrapper to make win32 asctime_s compatible to posix asctime_r.
Only available on Microsoft Windows.
Definition at line 318 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Based on the extension, returns the content type and content subtype.
For example:
| Ext | type | subtype |
|---|---|---|
| txt | text | plain |
| htm | text | html |
| xml | text | xml |
| mp3 | audio | mpeg |
The complete list you find at UPnPsdk::mediatype_list.
| [in] | a_extension | |
| [out] | a_con_type | |
| [out] | a_con_subtype |
Definition at line 346 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Based on the extension of the filename, clones an XML string based on type and content subtype.
If content type and sub type are not found, unknown types are used.
| [in] | filename | with extension, extension will be used. |
| [out] | fileInfo |
Definition at line 379 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::get_file_info | ( | const char * | filename, |
| UpnpFileInfo * | info | ||
| ) |
Get file information.
| [in] | filename | Filename having the description document. |
| [out] | info | File information object having file attributes such as filelength, when was the file last modified, whether a file or a directory and whether the file or directory is readable. |
Definition at line 430 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Compare file names.
Compare the file names between the one on the XML alias and the one passed in as the input parameter. If equal extract file information.
1 - On Success 0 if request is not an alias | [in] | request_file | request file passed in to be compared with. |
| [out] | alias | xml alias object which has a file name stored. |
| [out] | info | File information object which will be filled up if the file comparison succeeds. |
Definition at line 505 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::isFileInVirtualDir | ( | char * | filePath, |
| const void ** | cookie | ||
| ) |
Compares filePath with paths from the list of virtual directory lists.
| [in] | filePath | Directory path to be tested for virtual directory. |
| [out] | cookie | The cookie registered with this virtual directory, if matched. |
Definition at line 531 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void compa::anonymous_namespace{webserver.cpp}::ToUpperCase | ( | char * | s | ) |
Converts C string in place to upper case.
| [in,out] | s | string to be converted. |
Definition at line 572 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| char * compa::anonymous_namespace{webserver.cpp}::StrStr | ( | char * | s1, |
| const char * | s2 | ||
| ) |
Finds a substring from a string in a case insensitive way.
| [in] | s1 | Input string. |
| [in] | s2 | Input sub-string. |
Definition at line 586 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| char * compa::anonymous_namespace{webserver.cpp}::StrTok | ( | char ** | Src, |
| const char * | Del | ||
| ) |
Finds next token in a string.
| [in] | Src | String containing the token. |
| [in] | Del | Set of delimiter characters. |
Definition at line 622 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::GetNextRange | ( | char ** | SrcRangeStr, |
| off_t * | FirstByte, | ||
| off_t * | LastByte | ||
| ) |
Returns a range of integers from a string.
| SrcRangeStr | string containing the token / range. |
| FirstByte | gets the first byte of the token. |
| LastByte | gets the last byte of the token. |
Definition at line 650 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::CreateHTTPRangeResponseHeader | ( | char * | ByteRangeSpecifier, |
| off_t | FileLength, | ||
| struct SendInstruction * | Instr | ||
| ) |
Fills in the Offset, read size and contents to send out as an HTTP Range Response.
HTTP_BAD_REQUEST HTTP_INTERNAL_SERVER_ERROR HTTP_REQUEST_RANGE_NOT_SATISFIABLE HTTP_OK | ByteRangeSpecifier | String containing the range. | |
| FileLength | Length of the file. | |
| [out] | Instr | SendInstruction object where the range operations will be stored. |
Definition at line 707 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::CheckOtherHTTPHeaders | ( | http_message_t * | Req, |
| struct SendInstruction * | RespInstr, | ||
| off_t | FileSize | ||
| ) |
Get header id from the request parameter.
Get header id from the request parameter and take appropriate action based on the ids as an HTTP Range Response.
HTTP_BAD_REQUEST HTTP_INTERNAL_SERVER_ERROR HTTP_REQUEST_RANGE_NOT_SATISFIABLE HTTP_OK | [in] | Req | HTTP Request message. |
| [out] | RespInstr | Send Instruction object to data for the response. |
| FileSize | Size of the file containing the request document. |
Definition at line 822 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void compa::anonymous_namespace{webserver.cpp}::FreeExtraHTTPHeaders | ( | UpnpListHead * | extraHeadersList | ) |
Free extra HTTP headers.
| [in] | extraHeadersList | extra HTTP headers to free. |
Definition at line 945 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::ExtraHTTPHeaders | ( | http_message_t * | Req, |
| UpnpListHead * | extraHeadersList | ||
| ) |
Build an array of unrecognized headers.
| [in] | Req | HTTP Request message. |
| [in] | extraHeadersList | Extra header list. |
Definition at line 966 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::process_request_in | ( | SOCKINFO * | info, |
| http_message_t * | req, | ||
| enum resp_type * | rtype, | ||
| membuffer * | headers, | ||
| membuffer * | filename, | ||
| CXmlAlias * | a_alias, | ||
| SendInstruction * | RespInstr | ||
| ) |
Process a remote request and return the result.
Creates the different kind of header depending on the type of request.
| [in] | info | Socket info. |
| [in] | req | HTTP Request message. |
| [out] | rtype | Tpye of response. |
| [out] | headers | Headers. |
| [out] | filename | Get filename from request document. |
| [out] | a_alias | Xml alias document from the request document. |
| [out] | RespInstr | Send Instruction object where the response is set up. |
Definition at line 1025 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int compa::anonymous_namespace{webserver.cpp}::http_RecvPostMessage | ( | http_parser_t * | parser, |
| SOCKINFO * | info, | ||
| char * | filename, | ||
| struct SendInstruction * | Instr | ||
| ) |
Receives the HTTP post message.
| parser | HTTP Parser object. | |
| [in] | info | Socket Information object. |
| filename | File where received data is copied to. | |
| Instr | Send Instruction object which gives information whether the file is a virtual file or not. |
Definition at line 1393 of file webserver.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| const char* compa::anonymous_namespace{webserver.cpp}::gMediaTypes[] |
Media types.
Definition at line 84 of file webserver.cpp.
|
constexpr |
index to get media type of application from the media types table.
Definition at line 94 of file webserver.cpp.
|
constexpr |
Number of elements for asctime_s on win32, means buffer size.
Definition at line 97 of file webserver.cpp.
| CXmlAlias compa::anonymous_namespace{webserver.cpp}::gAliasDoc |
Global XML document object.
Definition at line 307 of file webserver.cpp.