libUPnP  1.8.4
client_table.h
Go to the documentation of this file.
1 
2 #ifndef CLIENT_TABLE_H
3 #define CLIENT_TABLE_H
4 
5 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 
16 #include "ClientSubscription.h"
17 #include "service_table.h"
18 #include "upnp.h"
19 #include "UpnpString.h"
20 #include "upnp_timeout.h"
21 #include "uri.h"
22 #include "TimerThread.h"
23 
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <time.h>
28 
29 
31 
32 
33 #ifdef INCLUDE_CLIENT_APIS
34 
35 
43  GenlibClientSubscription *sub);
44 
45 
51  GenlibClientSubscription *list);
52 
53 
61  GenlibClientSubscription **head,
63  const UpnpString *sid);
64 
65 
72 GenlibClientSubscription *GetClientSubClientSID(
74  GenlibClientSubscription *head,
76  const UpnpString *sid);
77 
78 
85 GenlibClientSubscription *GetClientSubActualSID(
87  GenlibClientSubscription *head,
89  token *sid);
90 
91 
92 #endif /* INCLUDE_CLIENT_APIS */
93 
94 
95 #ifdef __cplusplus
96 }
97 #endif /* __cplusplus */
98 
99 
100 #endif /* CLIENT_TABLE_H */
101 
web_server_set_root_dir
int web_server_set_root_dir(const char *root_dir)
Assign the path specfied by the input const char* root_dir parameter to the global Document root dire...
Definition: webserver.c:562
UpnpRegisterRootDevice3
int UpnpRegisterRootDevice3(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily)
Registers a device application for a specific address family with the UPnP library.
Definition: upnpapi.c:1064
VDCallback_Read
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Read callback function prototype.
Definition: upnp.h:2575
RemoveSubscriptionSID
void RemoveSubscriptionSID(Upnp_SID sid, service_info *service)
Definition: service_table.c:98
ixmlNode_getNodeName
EXPORT_SPEC const char * ixmlNode_getNodeName(IXML_Node *nodeptr)
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
Definition: node.c:122
tv_ctrlpt.h
SetHTTPGetCallback
void SetHTTPGetCallback(MiniServerCallback callback)
Set HTTP Get Callback.
gMediaTypeList
static struct document_type_t gMediaTypeList[70]
Definition: webserver.c:229
UpnpVirtualDir_set_WriteCallback
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition: upnpapi.c:4163
MServerSockArray::ssdpReqSock6
SOCKET ssdpReqSock6
Definition: miniserver.h:70
UpnpGetServiceVarStatus
int UpnpGetServiceVarStatus(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, DOMString *StVarVal)
Queries the state of a state variable of a service on another device.
Definition: upnpapi.c:2942
ActionComplete.h
UpnpActionComplete object declaration.
UpnpInitLog
int UpnpInitLog(void)
Initialize the log files.
Definition: upnpdebug.c:69
gSendThreadPool
ThreadPool gSendThreadPool
Definition: upnpapi.c:122
SUpnpString::m_string
char * m_string
Pointer to a dynamically allocated area that holds the NULL terminated string.
Definition: UpnpString.c:74
MServerSockArray
Definition: miniserver.h:45
UpnpCloseHttpConnection
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition: upnpapi.c:3167
freeService
void freeService(service_info *in)
Free's memory allocated for the various components of the service entry in the service table.
Definition: service_table.c:538
sysdep.h
VDCallback_Close
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie)
Close callback function prototype.
Definition: upnp.h:2649
AdvertiseAndReply
int AdvertiseAndReply(int AdFlag, UpnpDevice_Handle Hnd, enum SsdpSearchType SearchType, struct sockaddr *DestAddr, char *DeviceType, char *DeviceUDN, char *ServiceType, int Exp)
Sends SSDP advertisements, replies and shutdown messages.
Definition: ssdp_server.c:92
scanner_t::entire_msg_loaded
int entire_msg_loaded
Definition: httpparser.h:68
StateVarRequest.h
UpnpStateVarRequest object declararion.
gena_process_subscription_request
void gena_process_subscription_request(SOCKINFO *info, http_message_t *request)
Handles a subscription request from a ctrl point. The socket is not closed on return.
Definition: gena_device.c:1181
free_URL_list
void free_URL_list(URL_list *list)
Frees the memory associated with a URL_list.
Definition: uri.c:252
UPNPREG_BUF_DESC
@ UPNPREG_BUF_DESC
Definition: upnp.h:488
g_maxContentLength
size_t g_maxContentLength
Definition: upnpapi.c:166
Upnp_DescType_e
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition: upnp.h:478
g_UpnpSdkEQMaxAge
int g_UpnpSdkEQMaxAge
Definition: upnpapi.c:182
GlobalDebugMutex
static ithread_mutex_t GlobalDebugMutex
Definition: upnpdebug.c:52
http_message_t::request_method
http_method_t request_method
Definition: httpparser.h:186
ixmlNodeList_free
EXPORT_SPEC void ixmlNodeList_free(IXML_NodeList *nList)
Frees a NodeList object.
Definition: nodeList.c:143
TPAttrInit
int TPAttrInit(ThreadPoolAttr *attr)
Initializes thread pool attributes. Sets values to defaults defined in ThreadPool....
Definition: ThreadPool.c:1055
sock_make_blocking
int sock_make_blocking(SOCKET sock)
Make socket blocking.
Definition: sock.c:277
freeServiceList
void freeServiceList(service_info *head)
Free's memory allocated for the various components of each service entry in the service table.
Definition: service_table.c:581
SetSoapCallback
void SetSoapCallback(MiniServerCallback callback)
Set SOAP Callback.
UPNP_EVENT_SUBSCRIPTION_REQUEST
@ UPNP_EVENT_SUBSCRIPTION_REQUEST
Definition: Callback.h:83
UpnpOpenHttpGetProxy
int UpnpOpenHttpGetProxy(const char *url, const char *proxy_str, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL through the specified proxy.
Definition: upnpapi.c:3059
FileInfo.h
UpnpFileInfo object declararion.
UPNP_E_SOCKET_BIND
#define UPNP_E_SOCKET_BIND
The SDK had a problem binding a socket to a network interface.
Definition: upnp.h:267
ErrorString::rc
int rc
Definition: upnptools.c:69
ssdpsearcharg
Definition: ssdplib.h:144
UpnpOpenHttpPost
int UpnpOpenHttpPost(const char *url, void **handle, const char *contentType, int contentLength, int timeout)
Makes an HTTP POST request message, opens a connection to the server and sends the POST request to th...
Definition: upnpapi.c:2998
mserv_request_t::foreign_sockaddr
struct sockaddr_storage foreign_sockaddr
Definition: miniserver.c:75
uri.h
genaUnSubscribe
int genaUnSubscribe(UpnpClient_Handle client_handle, const UpnpString *in_sid)
Unsubscribes a SID.
Definition: gena_ctrlpt.c:457
GetSubscriptionSID
subscription * GetSubscriptionSID(const Upnp_SID sid, service_info *service)
Return the subscription from the service table that matches const Upnp_SID sid value.
Definition: service_table.c:123
membuffer_set_size
int membuffer_set_size(membuffer *m, size_t new_length)
Increases or decreases buffer cap so that at least 'new_length' bytes can be stored.
Definition: membuffer.c:104
Handle_Info
Definition: upnpapi.h:72
UPNP_TIMEOUT
Definition: upnp_timeout.h:45
UPNP_E_FILE_NOT_FOUND
#define UPNP_E_FILE_NOT_FOUND
The filename passed to one of the device registration functions was not found or was not accessible.
Definition: upnp.h:350
UpnpSdkClientRegistered
int UpnpSdkClientRegistered
Definition: upnpapi.c:190
TPAttrSetMinThreads
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads)
Sets the min threads for the thread pool attributes.
Definition: ThreadPool.c:1116
miniStopSockPort
uint16_t miniStopSockPort
Definition: miniserver.c:89
GenaAutoRenewSubscription
static void GenaAutoRenewSubscription(IN void *input)
This is a thread function to send the renewal just before the subscription times out.
Definition: gena_ctrlpt.c:67
glob_alias_init
static UPNP_INLINE void glob_alias_init(void)
Initialize the global XML document. Allocate buffers for the XML document.
Definition: webserver.c:360
THREADPOOL
A thread pool similar to the thread pool in the UPnP SDK.
Definition: ThreadPool.h:213
TimerThread.h
UpnpRegisterRootDevice
int UpnpRegisterRootDevice(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library.
Definition: upnpapi.c:763
Handle_Info::ServiceTable
service_table ServiceTable
Definition: upnpapi.h:106
ixmlPrintNode
EXPORT_SPEC char * ixmlPrintNode(IXML_Node *doc)
Renders a Node and all sub-elements into an XML text representation.
Definition: ixml.c:365
ixmlNode_getFirstChild
EXPORT_SPEC IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
Definition: node.c:307
SearchByTarget
int SearchByTarget(int Hnd, int Mx, char *St, void *Cookie)
Creates and send the search request for a specific URL.
Definition: ssdp_ctrlpt.c:545
URL_LIST
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA....
Definition: uri.h:149
VirtualDirCallbacks::close
VDCallback_Close close
Definition: VirtualDir.h:57
UpnpSetContentLength
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition: upnpapi.c:4201
UpnpPrintf
void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
Prints the debug statement either on the standard output or log file along with the information from ...
Definition: upnpdebug.c:127
UPNP_E_SUBSCRIBE_UNACCEPTED
#define UPNP_E_SUBSCRIBE_UNACCEPTED
A subscription request was rejected from the remote side.
Definition: upnp.h:326
GetHandleInfo
Upnp_Handle_Type GetHandleInfo(UpnpClient_Handle Hnd, struct Handle_Info **HndInfo)
Get handle information.
Definition: upnpapi.c:3855
UpnpSetMaxSubscriptions
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1814
ixmlFreeDOMString
EXPORT_SPEC void ixmlFreeDOMString(char *buf)
Frees a DOMString.
xml_alias_t::last_modified
time_t last_modified
Definition: webserver.c:98
UPNP_E_SOCKET_CONNECT
#define UPNP_E_SOCKET_CONNECT
The SDK had a problem connecting to a remote host.
Definition: upnp.h:277
THREADPOOLATTR
Definition: ThreadPool.h:141
SOCKINFO::socket
SOCKET socket
Definition: sock.h:62
get_port
static int get_port(SOCKET sockfd, uint16_t *port)
Returns port to which socket, sockfd, is bound.
Definition: miniserver.c:458
ListDelNode
void * ListDelNode(LinkedList *list, ListNode *dnode, int freeItem)
Removes a node from the list. The memory for the node is freed.
Definition: LinkedList.c:177
HOSTPORT
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
upnpdebug.h
gAliasDoc
static struct xml_alias_t gAliasDoc
Definition: webserver.c:235
printService
void printService(service_info *service, Upnp_LogLevel level, Dbg_Module module)
For debugging purposes prints information from the service passed into the function.
Definition: service_table.c:396
MEMBUF_DEF_SIZE_INC
#define MEMBUF_DEF_SIZE_INC
Definition: membuffer.h:66
Upnp_SID
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:445
UpnpString_dup
UpnpString * UpnpString_dup(const UpnpString *p)
Copy Constructor.
Definition: UpnpString.c:117
UpnpAcceptSubscription
int UpnpAcceptSubscription(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables, const Upnp_SID SubsId)
Accepts a subscription request and sends out the current state of the eventable variables for a servi...
Definition: upnpapi.c:2380
Handle_Info::LowerDescURL
char LowerDescURL[LINE_SIZE]
Definition: upnpapi.h:88
http_header_t::value
membuffer value
Definition: httpparser.h:174
UpnpCloseHttpGet
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:3104
ToUpperCase
static void ToUpperCase(char *s)
Converts input string to upper case.
Definition: webserver.c:655
UpnpRenewSubscription
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:2151
Handle_Info::ServiceList
IXML_NodeList * ServiceList
Definition: upnpapi.h:104
sock_read
int sock_read(SOCKINFO *info, char *buffer, size_t bufsize, int *timeoutSecs)
Reads data on socket in sockinfo.
Definition: sock.c:266
get_ssdp_sockets
int get_ssdp_sockets(MiniServerSockArray *out)
Creates the IPv4 and IPv6 ssdp sockets required by the control point and device operation.
Definition: ssdp_server.c:1165
http_message_t::status_code
int status_code
Definition: httpparser.h:188
gMiniServerThreadPool
ThreadPool gMiniServerThreadPool
Definition: upnpapi.c:128
upnpapi.h
UpnpSetLogLevel
void UpnpSetLogLevel(Upnp_LogLevel log_level)
Set the log level (see Upnp_LogLevel).
Definition: upnpdebug.c:85
free_routine
void(* free_routine)(void *arg)
Definition: ThreadPool.h:135
MServerSockArray::miniServerSock4
SOCKET miniServerSock4
Definition: miniserver.h:47
MServerSockArray::ssdpSock4
SOCKET ssdpSock4
Definition: miniserver.h:53
InfoFileHnd
static FILE * InfoFileHnd
Definition: upnpdebug.c:61
sock_write
int sock_write(SOCKINFO *info, const char *buffer, size_t bufsize, int *timeoutSecs)
Writes data on the socket in sockinfo.
Definition: sock.c:271
http_parser_t
Definition: httpparser.h:213
UpnpDownloadXmlDoc
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3190
gena_validate_delivery_urls
int gena_validate_delivery_urls(SOCKINFO *info, URL_list *url_list)
Validate that the URLs passed by the user are on the same network segment than the device.
Definition: gena_device.c:1127
UpnpSendActionExAsync
int UpnpSendActionExAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition: upnpapi.c:2751
gMServState
static MiniServerState gMServState
Definition: miniserver.c:94
UpnpClient_Handle
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:426
UpnpAcceptSubscriptionExt
int UpnpAcceptSubscriptionExt(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, IXML_Document *PropSet, const Upnp_SID SubsId)
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event ra...
Definition: upnpapi.c:2459
soap_device_callback
void soap_device_callback(http_parser_t *parser, http_message_t *request, SOCKINFO *info)
This is a callback called by minisever after receiving the request from the control point....
Definition: soap_device.c:701
ScheduleGenaAutoRenew
static int ScheduleGenaAutoRenew(IN int client_handle, IN int TimeOut, IN GenlibClientSubscription *sub)
Schedules a job to renew the subscription just before time out.
Definition: gena_ctrlpt.c:132
UPNP_EVENT_RENEWAL_COMPLETE
@ UPNP_EVENT_RENEWAL_COMPLETE
Definition: Callback.h:93
genaUnregisterClient
int genaUnregisterClient(UpnpClient_Handle client_handle)
Unsubcribes all the outstanding subscriptions and cleans the subscription list.
Definition: gena_ctrlpt.c:411
UPNP_E_INVALID_ACTION
#define UPNP_E_INVALID_ACTION
The SOAP action message is invalid.
Definition: upnp.h:182
UpnpRemoveAllVirtualDirs
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:4055
infoFileName
static const char * infoFileName
Definition: upnpdebug.c:67
UPNP_E_INVALID_PARAM
#define UPNP_E_INVALID_PARAM
One or more of the parameters passed to the function is not valid.
Definition: upnp.h:110
SOCKINFO::foreign_sockaddr
struct sockaddr_storage foreign_sockaddr
Definition: sock.h:64
UpnpSendAdvertisementLowPower
int UpnpSendAdvertisementLowPower(UpnpDevice_Handle Hnd, int Exp, int PowerState, int SleepPeriod, int RegistrationState)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1645
Handle_Info::DescDocument
IXML_Document * DescDocument
Definition: upnpapi.h:100
ixmlNode_getNodeValue
EXPORT_SPEC const char * ixmlNode_getNodeValue(IXML_Node *nodeptr)
Returns the value of the Node as a string.
Definition: node.c:253
print_http_headers
void print_http_headers(http_message_t *hmsg)
Print the HTTP headers.
Definition: httpparser.c:2199
http_OpenHttpConnection
int http_OpenHttpConnection(const char *url_str, void **Handle, int timeout)
Opens a connection to the server.
Definition: httpreadwrite.c:1103
gUpnpSdkNLSuuid
Upnp_SID gUpnpSdkNLSuuid
UpnpGetServiceVarStatusAsync
int UpnpGetServiceVarStatusAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, Upnp_FunPtr Fun, const void *Cookie)
Queries the state of a variable of a service, generating a callback when the operation is complete.
Definition: upnpapi.c:2873
linecopylen
void linecopylen(char dest[LINE_SIZE], const char *src, size_t srclen)
Determine if the srclen passed in paramter is less than the permitted LINE_SIZE. If it is use the pas...
Definition: util.c:60
UpnpRegisterRootDevice2
int UpnpRegisterRootDevice2(Upnp_DescType descriptionType, const char *description, size_t bufferLen, int config_baseURL, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library. Similar to UpnpRegisterRootDevice,...
Definition: upnpapi.c:923
MSERV_STOPPING
@ MSERV_STOPPING
Definition: miniserver.c:85
remove_escaped_chars
int remove_escaped_chars(char *in, size_t *size)
Removes http escaped characters such as: "%20" and replaces them with their character representation....
printServiceList
void printServiceList(service_info *service, Upnp_LogLevel level, Dbg_Module module)
For debugging purposes prints information of each service from the service table passed into the func...
Definition: service_table.c:453
membuffer::buf
char * buf
Definition: membuffer.h:58
MiniServerCallback
void(* MiniServerCallback)(http_parser_t *parser, http_message_t *request, SOCKINFO *info)
Definition: miniserver.h:75
TPAttrSetJobsPerThread
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread)
Sets the jobs per thread ratio.
Definition: ThreadPool.c:1143
UpnpOpenHttpGetEx
int UpnpOpenHttpGetEx(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int lowRange, int highRange, int timeout)
Gets specified number of bytes from a file specified in the URL.
Definition: upnpapi.c:3082
UpnpVirtualDir_set_GetInfoCallback
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:4124
UpnpRemoveVirtualDir
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:4006
UPNP_E_INVALID_SERVICE
#define UPNP_E_INVALID_SERVICE
The device ID/service ID pair does not refer to a valid service.
Definition: upnp.h:164
UPNP_E_LISTEN
#define UPNP_E_LISTEN
The SDK had a problem setting the socket to listen for incoming connections.
Definition: upnp.h:295
TPAttrSetMaxJobsTotal
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal)
Sets the maximum number jobs that can be qeued totally.
Definition: ThreadPool.c:1170
RESERVED
#define RESERVED
Definition: uri.h:80
copy_subscription
int copy_subscription(subscription *in, subscription *out)
Makes a copy of the subscription.
Definition: service_table.c:62
UPNP_EVENT_UNSUBSCRIBE_COMPLETE
@ UPNP_EVENT_UNSUBSCRIBE_COMPLETE
Definition: Callback.h:103
Upnp_FunPtr
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
UPNP_E_OUTOF_SOCKET
#define UPNP_E_OUTOF_SOCKET
The SDK cannot create any more sockets.
Definition: upnp.h:287
FindServiceControlURLPath
service_info * FindServiceControlURLPath(service_table *table, const char *controlURLPath)
Traverses the service table and finds the node whose control URL Path matches a know value.
Definition: service_table.c:348
error_respond
void error_respond(SOCKINFO *info, int error_code, http_message_t *hmsg)
Sends an error message to the control point in the case of incorrect GENA requests.
ListFind
ListNode * ListFind(LinkedList *list, ListNode *start, void *item)
Finds the specified item in the list.
Definition: LinkedList.c:272
UpnpCloseSocket
#define UpnpCloseSocket
Definition: UpnpInet.h:57
parse_uric
static size_t parse_uric(const char *in, size_t max, token *out)
Parses a string of uric characters starting at in[0] as defined in http://www.ietf....
Definition: uri.c:171
PARSE_OK
@ PARSE_OK
Definition: httpparser.h:161
UpnpRegisterClient
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition: upnpapi.c:1308
MServerSockArray::miniServerSock6
SOCKET miniServerSock6
Definition: miniserver.h:49
respond_ok
static int respond_ok(SOCKINFO *info, int time_out, subscription *sub, http_message_t *request)
Returns OK message in the case of a subscription request.
Definition: gena_device.c:969
membuffer_insert
int membuffer_insert(membuffer *m, const void *buf, size_t buf_len, size_t index)
Allocates memory for the new data to be inserted. Does memory management by moving the data from the ...
Definition: membuffer.c:212
namecopy
void namecopy(char dest[NAME_SIZE], const char *src)
Copy no of bytes spcified by the NAME_SIZE constant, from the source buffer. Null terminate the desti...
Definition: util.c:53
Discovery.h
UpnpDiscovery object declararion.
GetDeviceHandleInfo
Upnp_Handle_Type GetDeviceHandleInfo(UpnpDevice_Handle start, int AddressFamily, UpnpDevice_Handle *device_handle_out, struct Handle_Info **HndInfo)
Retrieves the device handle and information of the first device of the address family specified....
Definition: upnpapi.c:3782
_IXML_Document
Data structure representing the DOM Document.
Definition: ixml.h:198
UpnpActionComplete_delete
void UpnpActionComplete_delete(UpnpActionComplete *p)
UpnpRegisterRootDevice4
int UpnpRegisterRootDevice4(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily, const char *LowerDescUrl)
Registers a device application for a specific address family with the UPnP library....
Definition: upnpapi.c:1080
getSubElement
int getSubElement(const char *element_name, IXML_Node *node, IXML_Node **out)
Traverses through a list of XML nodes to find the node with the known element name.
Definition: service_table.c:678
http_header_t::name
memptr name
Definition: httpparser.h:170
Check_Connect_And_Wait_Connection
static int Check_Connect_And_Wait_Connection(SOCKET sock, int connect_res)
Checks socket connection and wait if it is not connected. It should be called just after connect.
Definition: httpreadwrite.c:93
ixmlNode_appendChild
EXPORT_SPEC int ixmlNode_appendChild(IXML_Node *nodeptr, IXML_Node *newChild)
Appends a child Node to the list of children of a Node.
Definition: node.c:606
UPNP_EVENT_SUBSCRIPTION_EXPIRED
@ UPNP_EVENT_SUBSCRIPTION_EXPIRED
Definition: Callback.h:115
memptr_cmp
int memptr_cmp(memptr *m, const char *s)
Compares characters of strings passed for number of bytes. If equal for the number of bytes,...
Definition: membuffer.c:63
PARSE_INCOMPLETE_ENTITY
@ PARSE_INCOMPLETE_ENTITY
Definition: httpparser.h:157
sock_destroy
int sock_destroy(SOCKINFO *info, int ShutdownMethod)
Associates an SSL object with the socket and begins the client-side SSL/TLS handshake.
Definition: sock.c:118
http_message_t::entity
memptr entity
Definition: httpparser.h:205
UpnpGetServerPort
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:659
UpnpSdkInit
int UpnpSdkInit
Definition: upnpapi.c:186
membuffer_assign_str
int membuffer_assign_str(membuffer *m, const char *c_str)
Wrapper function for membuffer_assign().
Definition: membuffer.c:195
getElementValue
DOMString getElementValue(IXML_Node *node)
Returns the clone of the element value.
Definition: service_table.c:645
TimerThreadShutdown
int TimerThreadShutdown(TimerThread *timer)
Shutdown the timer thread.
Definition: TimerThread.c:352
ErrorMessages
struct ErrorString ErrorMessages[]
Array of error structures.
Definition: upnptools.c:78
UPNPREG_URL_DESC
@ UPNPREG_URL_DESC
Definition: upnp.h:480
StrTok
static char * StrTok(char **Src, const char *Del)
Finds next token in a string.
Definition: webserver.c:707
UpnpUnSubscribeAsync
int UpnpUnSubscribeAsync(UpnpClient_Handle Hnd, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe...
Definition: upnpapi.c:2083
TPJobSetPriority
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority)
Sets the max threads for the thread pool attributes.
Definition: ThreadPool.c:1083
UPNP_E_ALREADY_REGISTERED
#define UPNP_E_ALREADY_REGISTERED
A client or a device is already registered.
Definition: upnp.h:222
parsetools.h
UpnpString_delete
void UpnpString_delete(UpnpString *p)
Destructor.
Definition: UpnpString.c:103
UpnpWriteHttpPost
int UpnpWriteHttpPost(void *handle, char *buf, size_t *size, int timeout)
Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttp...
Definition: upnpapi.c:3014
memptr
Definition: membuffer.h:47
ErrorString
Structure to maintain a error code and string associated with the error code.
Definition: upnptools.c:67
memptr::length
size_t length
Definition: membuffer.h:51
PRIzd
#define PRIzd
Supply the PRId64 printf() macro.
Definition: UpnpGlobal.h:116
UpnpString_clear
void UpnpString_clear(UpnpString *p)
Clears the string, sets its size to zero.
Definition: UpnpString.c:188
UpnpThreadDistribution
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
Schedule async functions in threadpool.
Definition: upnpapi.c:3646
UpnpVirtualDir_set_ReadCallback
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:4150
is_escaped
int is_escaped(const char *in)
Returns a 1 if a char[3] sequence is ESCAPED as defined in http://www.ietf.org/rfc/rfc2396....
Definition: uri.c:124
ixmlDocument_createElement
EXPORT_SPEC IXML_Element * ixmlDocument_createElement(IXML_Document *doc, const char *tagName)
Creates a new Element node with the given tag name.
bWebServerState
WebServerState bWebServerState
Definition: upnpapi.c:131
ssdplib.h
http_message_t::uri
uri_type uri
Definition: httpparser.h:184
MServerSockArray::miniServerStopSock
SOCKET miniServerStopSock
Definition: miniserver.h:51
http_header_t::name_id
int name_id
Definition: httpparser.h:172
UpnpAddToActionResponse
int UpnpAddToActionResponse(IXML_Document **ActionResponse, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgValue)
Creates an action response packet based on its output parameters (status variable name and value pair...
Definition: upnptools.c:398
UPNP_DEFAULT_LOG_LEVEL
#define UPNP_DEFAULT_LOG_LEVEL
Definition: upnpdebug.h:94
UpnpAddVirtualDir
int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
Definition: upnpapi.c:3937
VirtualDirCallbacks
Definition: VirtualDir.h:12
SetGenaCallback
void SetGenaCallback(MiniServerCallback callback)
Set GENA Callback.
SsdpSearchType
SsdpSearchType
Definition: ssdplib.h:66
xml_alias_t::name
membuffer name
Definition: webserver.c:94
ActionRequest.h
UpnpActionRequest object declaration.
UpnpString_assign
void UpnpString_assign(UpnpString *p, const UpnpString *q)
Assignment operator.
Definition: UpnpString.c:138
UpnpInit2
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnpapi.c:460
TimerThreadSchedule
int TimerThreadSchedule(TimerThread *timer, time_t timeout, TimeoutType type, ThreadPoolJob *job, Duration duration, int *id)
Schedules an event to run at a specified time.
Definition: TimerThread.c:245
UpnpReadHttpGet
int UpnpReadHttpGet(void *handle, char *buf, size_t *size, int timeout)
Gets specified number of bytes from a file specified in a URL.
Definition: upnpapi.c:3110
UPNP_E_SUCCESS
#define UPNP_E_SUCCESS
The operation completed successfully.
Definition: upnp.h:97
UpnpResolveURL2
int UpnpResolveURL2(const char *BaseURL, const char *RelURL, char **AbsURL)
Combines a base URL and a relative URL into a single absolute URL.
Definition: upnptools.c:168
UpnpEndHttpRequest
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition: upnpapi.c:3145
UPNP_E_OUTOF_HANDLE
#define UPNP_E_OUTOF_HANDLE
The SDK does not have any more space for additional handles.
Definition: upnp.h:117
CreateHTTPRangeResponseHeader
static 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.
Definition: webserver.c:790
membuffer_init
void membuffer_init(membuffer *m)
Wrapper to membuffer_initialize().
Definition: membuffer.c:152
UPNP_E_INVALID_ARGUMENT
#define UPNP_E_INVALID_ARGUMENT
One or more of the parameters passed to a function is invalid.
Definition: upnp.h:344
TPAttrSetStackSize
int TPAttrSetStackSize(ThreadPoolAttr *attr, size_t stackSize)
Sets the stack size for the thread pool attributes.
Definition: ThreadPool.c:1125
UPNP_INLINE
#define UPNP_INLINE
Declares an inline function.
Definition: UpnpGlobal.h:99
free_client_subscription
void free_client_subscription(GenlibClientSubscription *sub)
Free memory allocated for client subscription data.
Definition: client_table.c:22
http_MakeHttpRequest
int http_MakeHttpRequest(Upnp_HttpMethod method, const char *url_str, void *Handle, UpnpString *headers, const char *contentType, int contentLength, int timeout)
Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection.
Definition: httpreadwrite.c:1162
SUpnpString::m_length
size_t m_length
Length of the string.
Definition: UpnpString.c:71
document_type_t::content_type
const char * content_type
Definition: webserver.c:87
web_server_init
int web_server_init()
Initilialize the different documents. Initialize the memory for root directory for web server....
Definition: webserver.c:467
UpnpUnRegisterRootDevice
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1226
create_url_list
static int create_url_list(memptr *url_list, URL_list *out)
Function to parse the Callback header value in subscription requests.
Definition: gena_device.c:1037
UpnpVirtualDir_set_CloseCallback
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:4189
membuffer
Definition: membuffer.h:56
TOKEN
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
Definition: uri.h:117
httpparser.h
Handle_Info::DeviceAf
int DeviceAf
Definition: upnpapi.h:112
UpnpGetErrorMessage
const char * UpnpGetErrorMessage(int rc)
Converts an SDK error code into a string error message suitable for display. The memory returned from...
Definition: upnptools.c:126
PARSE_CONTINUE_1
@ PARSE_CONTINUE_1
Definition: httpparser.h:165
UPNP_EVENT_RECEIVED
@ UPNP_EVENT_RECEIVED
Definition: Callback.h:88
UPNP_E_INVALID_URL
#define UPNP_E_INVALID_URL
An URL passed into the function is invalid.
Definition: upnp.h:152
upnp.h
UpnpUnSubscribe
int UpnpUnSubscribe(UpnpClient_Handle Hnd, const Upnp_SID SubsId)
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscri...
Definition: upnpapi.c:2035
UPNP_E_FINISH
#define UPNP_E_FINISH
UpnpInit2 has not been called, or UpnpFinish has already been called.
Definition: upnp.h:189
TvCtrlPointStart
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr, int combo)
Call this function to initialize the UPnP library and start the TV Control Point. This function creat...
Definition: tv_ctrlpt.c:1216
gena_subscribe
static int gena_subscribe(IN const UpnpString *url, INOUT int *timeout, IN const UpnpString *renewal_sid, OUT UpnpString *sid)
Subscribes or renew subscription.
Definition: gena_ctrlpt.c:269
gIF_IPV6
char gIF_IPV6[INET6_ADDRSTRLEN]
Definition: upnpapi.c:143
UPNP_CONTROL_GET_VAR_COMPLETE
@ UPNP_CONTROL_GET_VAR_COMPLETE
Definition: Callback.h:41
GetDescDocumentAndURL
static int GetDescDocumentAndURL(Upnp_DescType descriptionType, char *description, int config_baseURL, int AddressFamily, IXML_Document **xmlDoc, char descURL[LINE_SIZE])
Fills the sockadr_in with miniserver information.
Definition: upnpapi.c:1593
get_content_type
static UPNP_INLINE int get_content_type(const char *filename, OUT UpnpFileInfo *fileInfo)
Based on the extension, clones an XML string based on type and content subtype. If content type and s...
Definition: webserver.c:314
genaNotify
static int genaNotify(char *headers, char *propertySet, subscription *sub)
Function to Notify a particular subscription of a particular event.
Definition: gena_device.c:254
UpnpIsWebserverEnabled
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:4114
free_notify_struct
static void free_notify_struct(notify_thread_struct *input)
Frees memory used in notify_threads if the reference count is 0, otherwise decrements the refrence co...
Definition: gena_device.c:148
ixmlCloneDOMString
EXPORT_SPEC char * ixmlCloneDOMString(const char *src)
Clones an existing DOMString.
MServerSockArray::ssdpReqSock4
SOCKET ssdpReqSock4
Definition: miniserver.h:67
gIF_NAME
char gIF_NAME[LINE_SIZE]
Definition: upnpapi.c:134
str_int_entry
Definition: strintmap.h:41
VDCallback_Write
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Write callback function prototype.
Definition: upnp.h:2598
gTimerThread
TimerThread gTimerThread
Definition: upnpapi.c:119
parse_hostport
static int parse_hostport(const char *in, unsigned short int defaultPort, hostport_type *out)
Parses a string representing a host and port (e.g. "127.127.0.1:80" or "localhost") and fills out a h...
Definition: uri.c:323
notify_send_and_recv
static UPNP_INLINE int notify_send_and_recv(uri_type *destination_url, membuffer *mid_msg, char *propertySet, http_parser_t *response)
Sends the notify message and returns a reply.
Definition: gena_device.c:170
UPNP_E_FILE_READ_ERROR
#define UPNP_E_FILE_READ_ERROR
An error happened while reading a file.
Definition: upnp.h:355
membuffer::capacity
size_t capacity
Definition: membuffer.h:62
UPNP_E_NOT_FOUND
#define UPNP_E_NOT_FOUND
The response to a SOAP request did not contain the required XML constructs.
Definition: upnp.h:370
ClientSubscription.h
GenlibClientSubscription object declararion.
membuffer_assign
int membuffer_assign(membuffer *m, const void *buf, size_t buf_len)
Allocate memory to membuffer *m and copy the contents of the in parameter const void *buf.
Definition: membuffer.c:170
UPNP_E_SOCKET_ERROR
#define UPNP_E_SOCKET_ERROR
Generic socket error code for conditions not covered by other error codes.
Definition: upnp.h:311
StartMiniServer
int StartMiniServer(uint16_t *listen_port4, uint16_t *listen_port6)
Initialize the sockets functionality for the Miniserver.
Definition: miniserver.c:862
search_extension
static UPNP_INLINE int search_extension(const char *extension, const char **con_type, const char **con_subtype)
Based on the extension, returns the content type and content subtype.
Definition: webserver.c:271
sock_make_no_blocking
int sock_make_no_blocking(SOCKET sock)
Make socket non-blocking.
Definition: sock.c:294
UpnpDownloadUrlItem
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition: upnpapi.c:3173
TIMERTHREAD
Definition: TimerThread.h:68
Handle_Info::ClientSubList
GenlibClientSubscription * ClientSubList
Definition: upnpapi.h:118
web_server_destroy
void web_server_destroy(void)
Release memory allocated for the global web server root directory and the global XML document....
Definition: webserver.c:495
UpnpSdkDeviceregisteredV6
int UpnpSdkDeviceregisteredV6
Definition: upnpapi.c:198
ixmlDocument_free
EXPORT_SPEC void ixmlDocument_free(IXML_Document *doc)
Frees a Document object and all Nodes associated with it.
Definition: document.c:54
UPNP_E_TIMEDOUT
#define UPNP_E_TIMEDOUT
Too much time elapsed before the required number of bytes were sent or received over a socket.
Definition: upnp.h:303
UpnpActionComplete
struct s_UpnpActionComplete UpnpActionComplete
Definition: TemplateInclude.h:136
http_GetHttpResponse
int http_GetHttpResponse(void *Handle, UpnpString *headers, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets the response from the server using a connection previously created by UpnpOpenHttpConnection.
Definition: httpreadwrite.c:1256
SOCKET_ERROR
#define SOCKET_ERROR
Definition: UpnpInet.h:54
UpnpSendAction
int UpnpSendAction(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition: upnpapi.c:2544
Handle_Info::Cookie
char * Cookie
Definition: upnpapi.h:78
membuffer_detach
char * membuffer_detach(membuffer *m)
Definition: membuffer.c:273
http_message_t::amount_discarded
size_t amount_discarded
Definition: httpparser.h:194
UpnpMakeHttpRequest
int UpnpMakeHttpRequest(Upnp_HttpMethod method, const char *url, void *handle, UpnpString *headers, const char *contentType, int contentLength, int timeout)
Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3129
copy_URL_list
int copy_URL_list(URL_list *in, URL_list *out)
Copies one URL_list into another.
Definition: uri.c:214
http_EndHttpRequest
int http_EndHttpRequest(void *Handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition: httpreadwrite.c:1238
AutoAdvertise
void AutoAdvertise(void *input)
This function is a timer thread scheduled by UpnpSendAdvertisement to the send advetisement again.
Definition: upnpapi.c:3910
GetClientHandleInfo
Upnp_Handle_Type GetClientHandleInfo(UpnpClient_Handle *client_handle_out, struct Handle_Info **HndInfo)
Get client handle info.
Definition: upnpapi.c:3760
mserv_request_t
Definition: miniserver.c:71
HEADER_LENGTH
#define HEADER_LENGTH
Definition: upnptools.c:57
ThreadPool.h
Handle_Info::MaxSubscriptionTimeOut
int MaxSubscriptionTimeOut
Definition: upnpapi.h:110
DebugAtThisLevel
int DebugAtThisLevel(Upnp_LogLevel DLevel, Dbg_Module Module)
Returns true if debug output should be done in this module.
Definition: upnpdebug.c:111
INVALID_SOCKET
#define INVALID_SOCKET
Definition: UpnpInet.h:51
parse_status_t
parse_status_t
Definition: httpparser.h:151
GetFreeHandle
static int GetFreeHandle()
Get a free handle.
Definition: upnpapi.c:717
ListNext
ListNode * ListNext(LinkedList *list, ListNode *node)
Returns the next item in the list.
Definition: LinkedList.c:245
LISTNODE
Definition: LinkedList.h:61
PrintHandleInfo
int PrintHandleInfo(UpnpClient_Handle Hnd)
Print handle info.
Definition: upnpapi.c:3882
UpnpHttpGetProgress
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition: upnpapi.c:3116
xml_alias_t
Definition: webserver.c:92
ListHead
ListNode * ListHead(LinkedList *list)
Returns the head of the list.
Definition: LinkedList.c:219
alias_release
static void alias_release(struct xml_alias_t *alias)
Release the XML document referred to by the input parameter. Free the allocated buffers associated wi...
Definition: webserver.c:401
FreeHandle
static int FreeHandle(int Upnp_Handle)
Free handle.
Definition: upnpapi.c:735
ixml.h
UpnpString_cmp
int UpnpString_cmp(UpnpString *p, UpnpString *q)
Compares two strings for equality. Case matters.
Definition: UpnpString.c:195
SOCKET
int SOCKET
Definition: UpnpInet.h:48
isFileInVirtualDir
static int isFileInVirtualDir(char *filePath, const void **cookie)
Compares filePath with paths from the list of virtual directory lists.
Definition: webserver.c:614
PrintThreadPoolStats
void PrintThreadPoolStats(ThreadPool *tp, const char *DbgFileName, int DbgLineNo, const char *msg)
Prints thread pool statistics.
Definition: upnpapi.c:529
GetNextRange
static int GetNextRange(char **SrcRangeStr, off_t *FirstByte, off_t *LastByte)
Returns a range of integers from a string.
Definition: webserver.c:736
LOCAL_PORT_V6
unsigned short LOCAL_PORT_V6
Definition: upnpapi.c:155
UpnpString
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:38
ListAddTail
ListNode * ListAddTail(LinkedList *list, void *item)
Adds a node to the tail of the list. Node gets added immediately before list.tail.
Definition: LinkedList.c:119
MiniServerState
MiniServerState
Definition: miniserver.c:79
ixmlDocument_createTextNode
EXPORT_SPEC IXML_Node * ixmlDocument_createTextNode(IXML_Document *doc, const char *data)
Creates a new Text node with the given data.
get_alias
static UPNP_INLINE int get_alias(const char *request_file, struct xml_alias_t *alias, UpnpFileInfo *info)
Compare the files names between the one on the XML alias the one passed in as the input parameter....
Definition: webserver.c:588
tv_device.h
media_list_init
static UPNP_INLINE void media_list_init(void)
Decodes list and stores it in gMediaTypeList.
Definition: webserver.c:242
THREADPOOLJOB
Definition: ThreadPool.h:164
ixmlNodeList_item
EXPORT_SPEC IXML_Node * ixmlNodeList_item(IXML_NodeList *nList, unsigned long index)
Retrieves a Node from a NodeList specified by a numerical index.
Definition: nodeList.c:54
gena.h
UpnpMakeAction
IXML_Document * UpnpMakeAction(const char *ActionName, const char *ServType, int NumArg, const char *Arg,...)
Creates an action request packet based on its input parameters (status variable name and value pair).
Definition: upnptools.c:351
HOSTPORT::text
token text
Definition: uri.h:128
_IXML_Node
Data structure common to all types of nodes.
Definition: ixml.h:173
UpnpString_get_String
const char * UpnpString_get_String(const UpnpString *p)
Returns the pointer to char.
Definition: UpnpString.c:159
genaNotifyThread
static void genaNotifyThread(void *input)
Thread job to Notify a control point.
Definition: gena_device.c:311
memptr::buf
char * buf
Definition: membuffer.h:49
membuffer.h
FindServiceId
service_info * FindServiceId(service_table *table, const char *serviceId, const char *UDN)
Traverses through the service table and returns a pointer to the service node that matches a known se...
Definition: service_table.c:259
ListInit
int ListInit(LinkedList *list, cmp_routine cmp_func, free_function free_func)
Initializes LinkedList. Must be called first and only once for List.
Definition: LinkedList.c:84
ErrorString::rcError
const char * rcError
Definition: upnptools.c:71
UPNP_E_INVALID_HANDLE
#define UPNP_E_INVALID_HANDLE
The handle passed to a function is not a recognized as a valid handle.
Definition: upnp.h:102
token_string_casecmp
int token_string_casecmp(token *in1, const char *in2)
Compares buffer in the token object with the buffer in in2.
Definition: uri.c:289
UpnpSubscribe
int UpnpSubscribe(UpnpClient_Handle Hnd, const char *PublisherUrl, int *TimeOut, Upnp_SID SubsId)
Registers a control point to receive event notifications from another device.
Definition: upnpapi.c:1964
membuffer_delete
void membuffer_delete(membuffer *m, size_t index, size_t num_bytes)
Shrink the size of the buffer depending on the current size of the bufer and te input parameters....
Definition: membuffer.c:240
http_SendMessage
int http_SendMessage(SOCKINFO *info, int *TimeOut, const char *fmt,...)
Sends a message to the destination based on the format parameter.
Definition: httpreadwrite.c:437
membuffer::size_inc
size_t size_inc
Definition: membuffer.h:64
print_uri
void print_uri(uri_type *in)
Function useful in debugging for printing a parsed uri.
Definition: uri.c:265
Handle_Info::MaxSubscriptions
int MaxSubscriptions
Definition: upnpapi.h:108
http_RecvPostMessage
static int http_RecvPostMessage(http_parser_t *parser, SOCKINFO *info, char *filename, struct SendInstruction *Instr)
Receives the HTTP post message.
Definition: webserver.c:1354
genaNotifyAll
int genaNotifyAll(UpnpDevice_Handle device_handle, char *UDN, char *servId, char **VarNames, char **VarValues, int var_count)
Sends a notification to all the subscribed control points.
Definition: gena_device.c:927
has_xml_content_type
int has_xml_content_type(http_message_t *hmsg)
Find the header from the HTTP message and match the header for xml data.
Definition: parsetools.c:48
UpnpUnRegisterRootDeviceLowPower
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1233
mserv_request_t::connfd
SOCKET connfd
Definition: miniserver.c:73
PARSE_INCOMPLETE
@ PARSE_INCOMPLETE
Definition: httpparser.h:155
gUUIDMutex
ithread_mutex_t gUUIDMutex
Definition: upnpapi.c:113
Handle_Info::aliasInstalled
int aliasInstalled
Definition: upnpapi.h:80
memptr_cmp_nocase
int memptr_cmp_nocase(memptr *m, const char *s)
Compares characters of 2 strings irrespective of the case for a specific count of bytes.
Definition: membuffer.c:78
UPNP_E_BAD_HTTPMSG
#define UPNP_E_BAD_HTTPMSG
The HTTP message contains invalid message headers.
Definition: upnp.h:214
TRUE
#define TRUE
Definition: upnputil.h:63
http_message_t
Definition: httpparser.h:179
Event.h
UpnpEvent object declararion.
document_type_t
Definition: webserver.c:83
StrStr
static char * StrStr(char *s1, const char *s2)
Finds a substring from a string in a case insensitive way.
Definition: webserver.c:670
ThreadPoolShutdown
int ThreadPoolShutdown(ThreadPool *tp)
Shuts the thread pool down. Waits for all threads to finish. May block indefinitely if jobs do not ex...
Definition: ThreadPool.c:978
UpnpNonblockParam
Definition: upnpapi.h:249
UpnpCloseLog
void UpnpCloseLog(void)
Closes the log files.
Definition: upnpdebug.c:90
http_parser_t::http_error_code
int http_error_code
Definition: httpparser.h:217
UPNP_E_NETWORK_ERROR
#define UPNP_E_NETWORK_ERROR
A network error occurred.
Definition: upnp.h:237
HTTPCONNECTIONHANDLE
Definition: httpreadwrite.c:922
token
struct TOKEN token
Buffer used in parsinghttp messages, urls, etc. generally this simply holds a pointer into a larger a...
UpnpNotify
int UpnpNotify(UpnpDevice_Handle, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables)
Sends out an event change notification to all control points subscribed to a particular service.
Definition: upnpapi.c:2279
gena_process_unsubscribe_request
void gena_process_unsubscribe_request(SOCKINFO *info, http_message_t *request)
Handles a subscription cancellation request from a ctrl point. The connection is not destroyed on ret...
Definition: gena_device.c:1486
RemoveClientSubClientSID
void RemoveClientSubClientSID(GenlibClientSubscription **head, const UpnpString *sid)
Remove the client subscription matching the subscritpion id represented by the const Upnp_SID sid par...
Definition: client_table.c:55
UpnpSendActionAsync
int UpnpSendActionAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition: upnpapi.c:2656
UpnpGetServerPort6
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 UPnP listening port.
Definition: upnpapi.c:667
UpnpInitPreamble
static int UpnpInitPreamble(void)
Performs the initial steps in initializing the UPnP SDK.
Definition: upnpapi.c:339
UpnpCancelHttpGet
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:3098
free_upnp_timeout
void free_upnp_timeout(upnp_timeout *event)
Free memory associated with event and memory for any sub-elements.
Definition: upnp_timeout.c:50
sample_util.h
UpnpSendActionEx
int UpnpSendActionEx(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition: upnpapi.c:2600
ListDestroy
int ListDestroy(LinkedList *list, int freeItem)
Removes all memory associated with list nodes. Does not free LinkedList *list.
Definition: LinkedList.c:200
xml_alias_t::doc
membuffer doc
Definition: webserver.c:96
makeAction
static IXML_Document * makeAction(int response, const char *ActionName, const char *ServType, int NumArg, const char *Arg, va_list ArgList)
Creates the action request or response from the argument list.
Definition: upnptools.c:271
client_table.h
GetDeviceHandleInfoForPath
Upnp_Handle_Type GetDeviceHandleInfoForPath(const char *path, int AddressFamily, UpnpDevice_Handle *device_handle_out, struct Handle_Info **HndInfo, service_info **serv_info)
Retrieves the device handle and information of the first device of the address family specified,...
Definition: upnpapi.c:3818
Handle_Info::HType
Upnp_Handle_Type HType
Definition: upnpapi.h:74
URI
Represents a URI used in parse_uri and elsewhere.
Definition: uri.h:136
TvDeviceStop
int TvDeviceStop(void)
Stops the device. Uninitializes the sdk.
Definition: tv_device.c:1378
UpnpVirtualDir_set_OpenCallback
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:4137
TPJobInit
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg)
Initializes thread pool job. Sets the priority to default defined in ThreadPool.h....
Definition: ThreadPool.c:1071
linecopy
void linecopy(char dest[LINE_SIZE], const char *src)
Copy no of bytes spcified by the LINE_SIZE constant, from the source buffer. Null terminate the desti...
Definition: util.c:46
UpnpOpenHttpGet
int UpnpOpenHttpGet(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL.
Definition: upnpapi.c:3037
UPNP_E_INVALID_DESC
#define UPNP_E_INVALID_DESC
The description document passed to UpnpRegisterRootDevice, UpnpRegisterRootDevice2 UpnpRegisterRootDe...
Definition: upnp.h:143
UpnpRenewSubscriptionAsync
int UpnpRenewSubscriptionAsync(UpnpClient_Handle Hnd, int TimeOut, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Renews a subscription that is about to expire, generating a callback when the operation is complete.
Definition: upnpapi.c:2207
freeClientSubList
void freeClientSubList(GenlibClientSubscription *list)
Free the client subscription table.
Definition: client_table.c:43
ThreadPoolAddPersistent
int ThreadPoolAddPersistent(ThreadPool *tp, ThreadPoolJob *job, int *jobId)
Adds a persistent job to the thread pool.
Definition: ThreadPool.c:768
SUpnpString
Internal implementation of the class UpnpString.
Definition: UpnpString.c:69
SampleUtil_Print
int SampleUtil_Print(const char *fmt,...)
Function emulating printf that ultimately calls the registered print function with the formatted stri...
Definition: sample_util.c:634
linux_print
void linux_print(const char *format,...)
Prints a string to standard out.
Definition: sample_util.c:666
UpnpVirtualDir_set_SeekCallback
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition: upnpapi.c:4176
UPNPREG_FILENAME_DESC
@ UPNPREG_FILENAME_DESC
Definition: upnp.h:484
addToAction
static int addToAction(int response, IXML_Document **ActionDoc, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgValue)
Adds the argument in the action request or response.
Definition: upnptools.c:196
http_header_t
Definition: httpparser.h:168
http_CloseHttpConnection
int http_CloseHttpConnection(void *Handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition: httpreadwrite.c:1413
membuffer::length
size_t length
Definition: membuffer.h:60
web_server_set_alias
int web_server_set_alias(const char *alias_name, const char *alias_content, size_t alias_content_length, time_t last_modified)
Replaces current alias with the given alias. To remove the current alias, set alias_name to NULL.
Definition: webserver.c:421
SendInstruction::ReadSendSize
off_t ReadSendSize
Definition: webserver.h:54
upnptools.h
SERVICE_TABLE
Definition: service_table.h:87
ixmlNode_getNodeType
EXPORT_SPEC unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr)
Retrieves the type of a Node. Note that not all possible return values are actually implemented.
Definition: node.c:287
addServiceTable
int addServiceTable(IXML_Node *node, service_table *in, const char *DefaultURLBase)
Add Service to the table.
Definition: service_table.c:992
UpnpString_set_StringN
int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n)
Sets the string from a pointer to char using a maximum of N chars.
Definition: UpnpString.c:176
TimerThreadRemove
int TimerThreadRemove(TimerThread *timer, int id, ThreadPoolJob *out)
Removes an event from the timer Q.
Definition: TimerThread.c:314
UpnpGetIfInfo
int UpnpGetIfInfo(const char *IfName)
Retrieve interface information and keep it in global variables. If NULL, we'll find the first suitabl...
Definition: upnpapi.c:3251
UpnpActionComplete_new
UpnpActionComplete * UpnpActionComplete_new()
UPNP_E_INVALID_INTERFACE
#define UPNP_E_INVALID_INTERFACE
The interface provided to UpnpInit2 is unknown or does not have a valid IPv4 or IPv6 address configur...
Definition: upnp.h:228
freeServiceTable
void freeServiceTable(service_table *table)
Free's dynamic memory in table (does not free table, only memory within the structure).
Definition: service_table.c:623
g_UpnpSdkEQMaxLen
int g_UpnpSdkEQMaxLen
Definition: upnpapi.c:172
parse_scheme
static size_t parse_scheme(const char *in, size_t max, token *out)
parses a uri scheme starting at in[0] as defined in http://www.ietf.org/rfc/rfc2396....
Definition: uri.c:469
virtualDirCallback
struct VirtualDirCallbacks virtualDirCallback
Definition: upnpapi.c:98
UpnpSendAdvertisement
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1638
gena_device.h
sock_read_write
static int sock_read_write(SOCKINFO *info, char *buffer, size_t bufsize, int *timeoutSecs, int bRead)
Receives or sends data. Also returns the time taken to receive or send data.
Definition: sock.c:154
VDCallback_GetInfo
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie)
Get-info callback function prototype.
Definition: upnp.h:2532
ErrFileHnd
static FILE * ErrFileHnd
Definition: upnpdebug.c:58
gIF_IPV4
char gIF_IPV4[INET_ADDRSTRLEN]
Definition: upnpapi.c:137
MServerSockArray::ssdpSock6
SOCKET ssdpSock6
Definition: miniserver.h:55
parse_uri_and_unescape
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
UPNP_E_URL_TOO_BIG
#define UPNP_E_URL_TOO_BIG
The URL passed into a function is too long.
Definition: upnp.h:203
UpnpPrintf
void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
Prints the debug statement either on the standard output or log file along with the information from ...
Definition: upnpdebug.c:127
UpnpSubscribeAsync
int UpnpSubscribeAsync(UpnpClient_Handle Hnd, const char *PublisherUrl, int TimeOut, Upnp_FunPtr Fun, const void *Cookie)
Performs the same operation as UpnpSubscribe, but returns immediately and calls the registered callba...
Definition: upnpapi.c:1890
ThreadPoolInit
int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr)
Initializes and starts ThreadPool. Must be called first and only once for ThreadPool.
Definition: ThreadPool.c:700
VDCallback_Open
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie)
Open callback function prototype.
Definition: upnp.h:2553
ithread.h
UpnpString_new
UpnpString * UpnpString_new(void)
Constructor.
Definition: UpnpString.c:77
freeSubscriptionList
void freeSubscriptionList(subscription *head)
Free's memory allocated for all the subscriptions in the service table.
Definition: service_table.c:228
TPAttrSetMaxThreads
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads)
Sets the max threads for the thread pool attributes.
Definition: ThreadPool.c:1107
sock_init
int sock_init(SOCKINFO *info, SOCKET sockfd)
Assign the passed in socket descriptor to socket descriptor in the SOCKINFO structure.
Definition: sock.c:73
scanner_t
Definition: httpparser.h:61
UpnpString_set_Length
void UpnpString_set_Length(UpnpString *p, size_t n)
Truncates the string to the specified lenght, or does nothing if the current lenght is less than or e...
Definition: UpnpString.c:150
UpnpDevice_Handle
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnp.h:436
UpnpSetMaxSubscriptionTimeOut
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1851
GlobalHndRWLock
ithread_rwlock_t GlobalHndRWLock
Definition: upnpapi.c:109
AllocGenaHeaders
static char * AllocGenaHeaders(const DOMString propertySet)
Allocates the GENA header.
Definition: gena_device.c:403
TPOOLSTATS
Definition: ThreadPool.h:175
membuffer_append_str
int membuffer_append_str(membuffer *m, const char *c_str)
Invokes function to appends data from a constant string to the buffer.
Definition: membuffer.c:207
ThreadPoolGetStats
int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats)
Returns various statistics about the thread pool.
Definition: ThreadPool.c:1201
Handle_Info::DeviceList
IXML_NodeList * DeviceList
Definition: upnpapi.h:102
TPJobSetFreeFunction
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func)
Sets the max threads for the thread pool attributes.
Definition: ThreadPool.c:1098
gIF_IPV4_NETMASK
char gIF_IPV4_NETMASK[INET_ADDRSTRLEN]
Definition: upnpapi.c:140
genaInitNotifyExt
int genaInitNotifyExt(UpnpDevice_Handle device_handle, char *UDN, char *servId, IXML_Document *PropSet, const Upnp_SID sid)
Similar to the genaInitNofity. The only difference is that it takes the xml document for the state ta...
Definition: gena_device.c:666
UpnpOpenHttpConnection
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition: upnpapi.c:3122
UPNP_E_INIT_FAILED
#define UPNP_E_INIT_FAILED
UpnpInit2 cannot complete.
Definition: upnp.h:196
UpnpAddToAction
int UpnpAddToAction(IXML_Document **ActionDoc, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgValue)
Adds the argument in the action request.
Definition: upnptools.c:387
http_message_t::msg
membuffer msg
Definition: httpparser.h:208
SOCKINFO
Definition: sock.h:60
UpnpInitMutexes
static int UpnpInitMutexes(void)
Initializes the global mutexes used by the UPnP SDK.
Definition: upnpapi.c:260
LINKEDLIST
Definition: LinkedList.h:84
gena_unsubscribe
static int gena_unsubscribe(IN const UpnpString *url, IN const UpnpString *sid, OUT http_parser_t *response)
Sends the UNSUBCRIBE gena request and recieves the response from the device and returns it as a param...
Definition: gena_ctrlpt.c:209
MServerSockArray::ssdpSock6UlaGua
SOCKET ssdpSock6UlaGua
Definition: miniserver.h:57
token_cmp
int token_cmp(token *in1, token *in2)
Compares two tokens.
Definition: uri.c:308
genaCallback
void genaCallback(http_parser_t *parser, http_message_t *request, SOCKINFO *info)
This is the callback function called by the miniserver to handle incoming GENA requests.
http_message_t::is_request
int is_request
Definition: httpparser.h:197
is_unreserved
int is_unreserved(char in)
Returns a 1 if a char is an UNRESERVED char as defined in http://www.ietf.org/rfc/rfc2396....
Definition: uri.c:104
VirtualDirCallbacks::read
VDCallback_Read read
Definition: VirtualDir.h:31
upnp_timeout.h
SendInstruction::RecvWriteSize
long RecvWriteSize
Definition: webserver.h:56
_IXML_NodeList
Data structure representing a list of nodes.
Definition: ixml.h:246
getServiceTable
int getServiceTable(IXML_Node *node, service_table *out, const char *DefaultURLBase)
Retrieve service from the table.
Definition: service_table.c:1045
resp_type
resp_type
Definition: webserver.c:74
DOMString
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
UpnpGetServerIpAddress
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:679
ixmlDocument_getElementsByTagName
EXPORT_SPEC IXML_NodeList * ixmlDocument_getElementsByTagName(IXML_Document *doc, const char *tagName)
Returns a NodeList of all Elements that match the given tag name in the order in which they were enco...
UpnpGetServerIp6Address
char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:687
UpnpInitThreadPools
static int UpnpInitThreadPools(void)
Initializes the global threadm pools used by the UPnP SDK.
Definition: upnpapi.c:290
UpnpSearchAsync
int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *TTarget_constarget_const, const void *Cookie_const)
Searches for devices matching the given search target.
Definition: upnpapi.c:1757
UpnpSdkDeviceRegisteredV4
int UpnpSdkDeviceRegisteredV4
Definition: upnpapi.c:194
membuffer_append
int membuffer_append(membuffer *m, const void *buf, size_t buf_len)
Invokes function to appends data from a constant buffer to the buffer.
Definition: membuffer.c:200
CheckOtherHTTPHeaders
static int CheckOtherHTTPHeaders(http_message_t *Req, struct SendInstruction *RespInstr, off_t FileSize)
Get header id from the request parameter and take appropriate action based on the ids as an HTTP Rang...
Definition: webserver.c:908
GlobalClientSubscribeMutex
ithread_mutex_t GlobalClientSubscribeMutex
Definition: upnpapi.c:105
VDCallback_Seek
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie)
Seek callback function prototype.
Definition: upnp.h:2621
str_alloc
char * str_alloc(const char *str, size_t str_len)
Allocate memory and copy information from the input string to the newly allocated memory.
Definition: membuffer.c:48
GeneratePropertySet
static int GeneratePropertySet(char **names, char **values, int count, DOMString *out)
Generates XML property set for notifications.
Definition: gena_device.c:96
ixmlNodeList_length
EXPORT_SPEC unsigned long ixmlNodeList_length(IXML_NodeList *nList)
Returns the number of Nodes in a NodeList.
Definition: nodeList.c:128
GetClientSubClientSID
GenlibClientSubscription * GetClientSubClientSID(GenlibClientSubscription *head, const UpnpString *sid)
Return the client subscription from the client table that matches const Upnp_SID sid subscrition id v...
Definition: client_table.c:82
gIF_INDEX
unsigned gIF_INDEX
Definition: upnpapi.c:149
UpnpCreatePropertySet
IXML_Document * UpnpCreatePropertySet(int NumArg, const char *Arg,...)
Creates a property set message packet.
Definition: upnptools.c:409
gDocumentRootDir
membuffer gDocumentRootDir
Definition: webserver.c:232
ThreadPoolAdd
int ThreadPoolAdd(ThreadPool *tp, ThreadPoolJob *job, int *jobId)
Adds a job to the thread pool. Job will be run as soon as possible.
Definition: ThreadPool.c:816
NOTIFY_THREAD_STRUCT
Definition: gena.h:144
miniserver.h
PARSE_FAILURE
@ PARSE_FAILURE
Definition: httpparser.h:159
uuid_create
int uuid_create(uuid_upnp *uid)
Generator of a UUID.
Definition: uuid.c:53
VirtualDirCallbacks::write
VDCallback_Write write
Definition: VirtualDir.h:38
Handle_Info::Callback
Upnp_FunPtr Callback
Definition: upnpapi.h:76
http_MakeMessage
int http_MakeMessage(membuffer *buf, int http_major_version, int http_minor_version, const char *fmt,...)
Generate an HTTP message based on the format that is specified in the input parameters.
Definition: httpreadwrite.c:1470
UpnpAddToPropertySet
int UpnpAddToPropertySet(IXML_Document **PropSet, const char *ArgName, const char *ArgValue)
Can be used when an application needs to transfer the status of many variables at once.
Definition: upnptools.c:458
UPNP_EVENT_SUBSCRIBE_COMPLETE
@ UPNP_EVENT_SUBSCRIBE_COMPLETE
Definition: Callback.h:98
UpnpString_casecmp
int UpnpString_casecmp(UpnpString *p, UpnpString *q)
Compares two strings for equality. Case does not matter.
Definition: UpnpString.c:203
genaRenewSubscription
int genaRenewSubscription(UpnpClient_Handle client_handle, const UpnpString *in_sid, int *TimeOut)
Renews a SID.
Definition: gena_ctrlpt.c:598
is_mark
int is_mark(char in)
Returns a 1 if a char is a MARK char as defined in http://www.ietf.org/rfc/rfc2396....
Definition: uri.c:86
UpnpInitLog
int UpnpInitLog(void)
Initialize the log files.
Definition: upnpdebug.c:69
ReadResponseLineAndHeaders
static int ReadResponseLineAndHeaders(IN SOCKINFO *info, IN OUT http_parser_t *parser, IN OUT int *timeout_secs, IN OUT int *http_error_code)
Parses already exiting data. If not complete reads more data on the connected socket....
Definition: httpreadwrite.c:941
http_message_t::urlbuf
char * urlbuf
Definition: httpparser.h:210
genaSubscribe
int genaSubscribe(UpnpClient_Handle client_handle, const UpnpString *PublisherURL, int *TimeOut, UpnpString *out_sid)
This function subscribes to a PublisherURL (also mentioned as EventURL in some places).
Definition: gena_ctrlpt.c:509
genaInitNotify
int genaInitNotify(UpnpDevice_Handle device_handle, char *UDN, char *servId, char **VarNames, char **VarValues, int var_count, const Upnp_SID sid)
Sends the intial state table dump to newly subscribed control point.
Definition: gena_device.c:624
EventSubscribe.h
UpnpEventSubscribe object declararion.
http_message_t::headers
LinkedList headers
Definition: httpparser.h:203
UpnpResolveURL
int UpnpResolveURL(const char *BaseURL, const char *RelURL, char *AbsURL)
Combines a base URL and a relative URL into a single absolute URL.
Definition: upnptools.c:144
scanner_t::cursor
size_t cursor
Definition: httpparser.h:65
UPNP_CONTROL_ACTION_COMPLETE
@ UPNP_CONTROL_ACTION_COMPLETE
Definition: Callback.h:30
device_main
int device_main(int argc, char *argv[])
Main entry point for tv device application.
Definition: tv_device.c:1418
UpnpNotifyExt
int UpnpNotifyExt(UpnpDevice_Handle, const char *DevID, const char *ServID, IXML_Document *PropSet)
Similar to UpnpNotify except that it takes a DOM document for the event rather than an array of strin...
Definition: upnpapi.c:2333
sock_close
static UPNP_INLINE int sock_close(SOCKET sock)
Closes the socket if it is different from -1.
Definition: sock.h:79
LOCAL_PORT_V4
unsigned short LOCAL_PORT_V4
Definition: upnpapi.c:152
parse_uri
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
Handle_Info::SsdpSearchList
LinkedList SsdpSearchList
Definition: upnpapi.h:120
ListSize
long ListSize(LinkedList *list)
Returns the size of the list.
Definition: LinkedList.c:301
http_message_t::method
http_method_t method
Definition: httpparser.h:182
_uuid_upnp
Definition: uuid.h:26
UPNP_E_SOCKET_READ
#define UPNP_E_SOCKET_READ
An error happened while reading from a socket.
Definition: upnp.h:257
SubscriptionRequest.h
UpnpSubscriptionRequest object declararion.
remove_dots
int remove_dots(char *buf, size_t size)
Removes ".", and ".." from a path.
Definition: uri.c:527
Handle_Info::DescURL
char DescURL[LINE_SIZE]
Definition: upnpapi.h:85
get_file_info
static int get_file_info(const char *filename, OUT UpnpFileInfo *info)
Release memory allocated for the global web server root directory and the global XML document....
Definition: webserver.c:517
genaUnregisterDevice
int genaUnregisterDevice(UpnpDevice_Handle device_handle)
Unregisters a device.
Definition: gena_device.c:66
g_log_level
static Upnp_LogLevel g_log_level
Definition: upnpdebug.c:55
errFileName
static const char * errFileName
Definition: upnpdebug.c:64
sock_init_with_ip
int sock_init_with_ip(SOCKINFO *info, SOCKET sockfd, struct sockaddr *foreign_sockaddr)
Calls the sock_init function and assigns the passed in IP address and port to the IP address and port...
Definition: sock.c:83
upnp_uuid_unpack
void upnp_uuid_unpack(uuid_upnp *u, char *out)
Out will be xxxx-xx-xx-xx-xxxxxx format.
Definition: uuid.c:85
VirtualDirCallbacks::open
VDCallback_Open open
Definition: VirtualDir.h:20
PARSE_SUCCESS
@ PARSE_SUCCESS
Definition: httpparser.h:153
UpnpWriteHttpRequest
int UpnpWriteHttpRequest(void *handle, char *buf, size_t *size, int timeout)
Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest call. The end of the content ...
Definition: upnpapi.c:3138
copy_token
static void copy_token(const token *in, const char *in_base, token *out, char *out_base)
Tokens are generally pointers into other strings. This copies the offset and size from a token (in) r...
Definition: uri.c:199
PARSE_NO_MATCH
@ PARSE_NO_MATCH
Definition: httpparser.h:163
http_WriteHttpRequest
int http_WriteHttpRequest(void *Handle, char *buf, size_t *size, int timeout)
Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest call. The end of the content ...
Definition: httpreadwrite.c:1191
SubscribeLock
#define SubscribeLock()
Locks the subscription.
Definition: gena.h:122
service_table.h
UPNP_E_INTERNAL_ERROR
#define UPNP_E_INTERNAL_ERROR
Generic error code for internal conditions not covered by other error codes.
Definition: upnp.h:376
SendInstruction::Cookie
const void * Cookie
Definition: webserver.h:58
TvCtrlPointCommandLoop
void * TvCtrlPointCommandLoop(void *args)
Function that receives commands from the user at the command prompt during the lifetime of the device...
Definition: tv_ctrlpt.c:1458
UpnpString.h
UpnpString object declaration.
UpnpReadHttpResponse
int UpnpReadHttpResponse(void *handle, char *buf, size_t *size, int timeout)
Reads the content of a response using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3160
SUBSCRIPTION
Definition: service_table.h:58
UpnpSetLogFileNames
void UpnpSetLogFileNames(const char *ErrFileName, const char *InfoFileName)
Set the name for error and information files, respectively.
Definition: upnpdebug.c:101
UpnpString_set_String
int UpnpString_set_String(UpnpString *p, const char *s)
Sets the string from a pointer to char.
Definition: UpnpString.c:164
TPAttrSetIdleTime
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime)
Sets the idle time for the thread pool attributes.
Definition: ThreadPool.c:1134
get_miniserver_stopsock
static int get_miniserver_stopsock(MiniServerSockArray *out)
Creates the miniserver STOP socket. This socket is created and listened on to know when it is time to...
Definition: miniserver.c:805
TimerThreadInit
int TimerThreadInit(TimerThread *timer, ThreadPool *tp)
Initializes and starts timer thread.
Definition: TimerThread.c:189
UPNP_E_UNSUBSCRIBE_UNACCEPTED
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED
An unsubscribe request was rejected from the remote side.
Definition: upnp.h:331
HandleTable
static void * HandleTable[NUM_HANDLE]
Definition: upnpapi.c:158
REL_SEC
@ REL_SEC
Definition: TimerThread.h:55
UPNP_E_BAD_RESPONSE
#define UPNP_E_BAD_RESPONSE
The response received from the remote side of a connection is not correct for the protocol.
Definition: upnp.h:172
soaplib.h
MSERV_RUNNING
@ MSERV_RUNNING
Definition: miniserver.c:83
ixmlParseBufferEx
EXPORT_SPEC int ixmlParseBufferEx(const char *buffer, IXML_Document **doc)
Parses an XML text buffer converting it into an IXML DOM representation.
Definition: ixml.c:428
StopMiniServer
int StopMiniServer()
Stop and Shutdown the MiniServer and free socket resources.
Definition: miniserver.c:968
document_type_t::content_subtype
const char * content_subtype
Definition: webserver.c:89
UpnpMakeActionResponse
IXML_Document * UpnpMakeActionResponse(const char *ActionName, const char *ServType, int NumArg, const char *Arg,...)
Ceates an action response packet based on its output parameters (status variable name and value pair)...
Definition: upnptools.c:369
UpnpSetMaxContentLength
int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
Definition: upnpapi.c:4232
_IXML_Element
Data structure representing an Element node.
Definition: ixml.h:216
virtual_Dir_List
Definition: VirtualDir.h:62
UPNP_E_CANCELED
#define UPNP_E_CANCELED
The operation was canceled.
Definition: upnp.h:319
StateVarComplete.h
UpnpStateVarComplete object declararion.
gena_process_subscription_renewal_request
void gena_process_subscription_renewal_request(SOCKINFO *info, http_message_t *request)
Handles a subscription renewal request from a ctrl point. The connection is not destroyed on return.
Definition: gena_device.c:1376
UPNP_EVENT_AUTORENEWAL_FAILED
@ UPNP_EVENT_AUTORENEWAL_FAILED
Definition: Callback.h:109
TvDeviceCommandLoop
void * TvDeviceCommandLoop(void *args)
Function that receives commands from the user at the command prompt during the lifetime of the device...
Definition: tv_device.c:1388
UpnpInet.h
Provides a platform independent way to include TCP/IP types and functions.
http_message_t::status_msg
membuffer status_msg
Definition: httpparser.h:190
UpnpGetHttpResponse
int UpnpGetHttpResponse(void *handle, UpnpString *headers, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets the response from the server using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3151
UpnpEnableWebserver
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:4077
printServiceTable
void printServiceTable(service_table *table, Upnp_LogLevel level, Dbg_Module module)
For debugging purposes prints the URL base of the table and information of each service from the serv...
Definition: service_table.c:512
alias_grab
static void alias_grab(struct xml_alias_t *alias)
Copy the contents of the global XML document into the local output parameter.
Definition: webserver.c:386
SubscribeUnlock
#define SubscribeUnlock()
Unlocks the subscription.
Definition: gena.h:133
removeServiceTable
int removeServiceTable(IXML_Node *node, service_table *in)
This function assumes that services for a particular root device are placed linearly in the service t...
Definition: service_table.c:917
GetCallBackFn
Upnp_FunPtr GetCallBackFn(UpnpClient_Handle Hnd)
Get callback function ptr from a handle.
Definition: upnpapi.c:3753
membuffer_attach
void membuffer_attach(membuffer *m, char *new_buf, size_t buf_len)
Definition: membuffer.c:287
gIF_IPV6_ULA_GUA
char gIF_IPV6_ULA_GUA[INET6_ADDRSTRLEN]
Definition: upnpapi.c:146
gena_process_notification_event
void gena_process_notification_event(SOCKINFO *info, http_message_t *event)
This function processes NOTIFY events that are sent by devices.
Definition: gena_ctrlpt.c:696
UpnpFinish
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition: upnpapi.c:585
membuffer_destroy
void membuffer_destroy(membuffer *m)
Free's memory allocated for membuffer* m.
Definition: membuffer.c:160
UpnpUnRegisterClient
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1356
FindServiceEventURLPath
service_info * FindServiceEventURLPath(service_table *table, const char *eventURLPath)
Traverses the service table and finds the node whose event URL Path matches a know value.
Definition: service_table.c:296
upnputil.h
process_request
static int process_request(http_message_t *req, enum resp_type *rtype, membuffer *headers, membuffer *filename, struct xml_alias_t *alias, struct SendInstruction *RespInstr)
Processes the request and returns the result in the output parameters.
Definition: webserver.c:1034
UpnpSetWebServerRootDir
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
free_function
void(* free_function)(void *arg)
Definition: LinkedList.h:52
http_parser_t::entity_start_position
size_t entity_start_position
Definition: httpparser.h:228
gRecvThreadPool
ThreadPool gRecvThreadPool
Definition: upnpapi.c:125
UpnpCloseHttpPost
int UpnpCloseHttpPost(void *handle, int *httpStatus, int timeout)
Sends and receives any pending data, closes the connection with the server, and frees memory allocate...
Definition: upnpapi.c:3024
sock.h
resolve_rel_url
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
UPNP_E_SOCKET_WRITE
#define UPNP_E_SOCKET_WRITE
An error happened while writing to a socket.
Definition: upnp.h:247
print_token
void print_token(token *in)
Function useful in debugging for printing a token.
Definition: uri.c:276
VirtualDirCallbacks::seek
VDCallback_Seek seek
Definition: VirtualDir.h:51
device_handle
UpnpDevice_Handle device_handle
Definition: tv_device.c:73
RunMiniServer
static void RunMiniServer(MiniServerSockArray *miniSock)
Run the miniserver.
Definition: miniserver.c:371
VirtualDirCallbacks::get_info
VDCallback_GetInfo get_info
Definition: VirtualDir.h:15
GetNextSubscription
subscription * GetNextSubscription(service_info *service, subscription *current)
Get current and valid subscription from the service table.
Definition: service_table.c:159
gSDKInitMutex
ithread_mutex_t gSDKInitMutex
Definition: upnpapi.c:116
ixmlNode_getNextSibling
EXPORT_SPEC IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
Definition: node.c:346
UPNP_E_NOTIFY_UNACCEPTED
#define UPNP_E_NOTIFY_UNACCEPTED
The remote host did not accept the notify sent from the local device.
Definition: upnp.h:336
APPLICATION_LISTENING_PORT
#define APPLICATION_LISTENING_PORT
Definition: miniserver.c:69
http_ReadHttpResponse
int http_ReadHttpResponse(void *Handle, char *buf, size_t *size, int timeout)
Reads the content of a response using a connection previously created by UpnpOpenHttpConnection.
Definition: httpreadwrite.c:1315
genaNotifyAllExt
int genaNotifyAllExt(UpnpDevice_Handle device_handle, char *UDN, char *servId, IXML_Document *PropSet)
Sends a notification to all the subscribed control points.
Definition: gena_device.c:891
document_type_t::file_ext
const char * file_ext
Definition: webserver.c:85
GetClientSubActualSID
GenlibClientSubscription * GetClientSubActualSID(GenlibClientSubscription *head, token *sid)
Returns the client subscription from the client subscription table that has the matching token *sid b...
Definition: client_table.c:101
gena_ctrlpt.h
MSERV_IDLE
@ MSERV_IDLE
Definition: miniserver.c:81
token_string_cmp
int token_string_cmp(token *in1, char *in2)
Compares a null terminated string to a token (exact).
Definition: uri.c:299
pVirtualDirList
virtualDirList * pVirtualDirList
Definition: upnpapi.c:101
URL_LIST::URLs
char * URLs
Definition: uri.h:153
SendInstruction
Definition: webserver.h:45
WinsockInit
static int WinsockInit(void)
(Windows Only) Initializes the Windows Winsock library.
Definition: upnpapi.c:217
UPNP_E_EXT_NOT_XML
#define UPNP_E_EXT_NOT_XML
The file name of the description document passed to UpnpRegisterRootDevice2 does not end in "....
Definition: upnp.h:361
freeSubscription
void freeSubscription(subscription *sub)
Free's the memory allocated for storing the URL of the subscription.
Definition: service_table.c:206
UPNP_E_INIT
#define UPNP_E_INIT
The SDK has already been initialized.
Definition: upnp.h:134
GetFirstSubscription
subscription * GetFirstSubscription(service_info *service)
Gets pointer to the first subscription node in the service table.
Definition: service_table.c:192
readFromSSDPSocket
void readFromSSDPSocket(SOCKET socket)
This function reads the data from the ssdp socket.
Definition: ssdp_server.c:694
ixmlElement_getElementsByTagName
EXPORT_SPEC IXML_NodeList * ixmlElement_getElementsByTagName(IXML_Element *element, const char *tagName)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are e...
replace_escaped
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
UpnpDisplayFileAndLine
void UpnpDisplayFileAndLine(FILE *fd, const char *DbgFileName, int DbgLineNo)
Writes the file name and file number from where debug statement is coming to the log file.
Definition: upnpdebug.c:176
SERVICE_INFO
Definition: service_table.h:74
xml_alias_t::ct
int * ct
Definition: webserver.c:100
UPNP_E_OUTOF_MEMORY
#define UPNP_E_OUTOF_MEMORY
Not enough resources are currently available to complete the operation.
Definition: upnp.h:126
UpnpString_get_Length
size_t UpnpString_get_Length(const UpnpString *p)
Returns the length of the string.
Definition: UpnpString.c:145
UpnpCloseLog
void UpnpCloseLog(void)
Closes the log files.
Definition: upnpdebug.c:90
is_reserved
static int is_reserved(char in)
Returns a 1 if a char is a RESERVED char as defined in http://www.ietf.org/rfc/rfc2396....
Definition: uri.c:68
UpnpInitStartServers
static int UpnpInitStartServers(unsigned short DestPort)
Finishes initializing the UPnP SDK.
Definition: upnpapi.c:421
is_valid_alias
static UPNP_INLINE int is_valid_alias(const struct xml_alias_t *alias)
Check for the validity of the XML object buffer.
Definition: webserver.c:375
http_RecvMessage
int http_RecvMessage(IN SOCKINFO *info, OUT http_parser_t *parser, IN http_method_t request_method, IN OUT int *timeout_secs, OUT int *http_error_code)
Get the data on the socket and take actions based on the read data to modify the parser objects buffe...
Definition: httpreadwrite.c:344