Go to the documentation of this file.
2 #ifndef SSDP_RESULTDATA_H
3 #define SSDP_RESULTDATA_H
19 #ifdef TEMPLATE_GENERATE_SOURCE
20 #undef TEMPLATE_GENERATE_SOURCE
24 #define TEMPLATE_GENERATE_SOURCE
35 #define CLASS SSDPResultData
37 #define EXPAND_CLASS_MEMBERS(CLASS) \
38 EXPAND_CLASS_MEMBER_OBJECT(CLASS, Param, UpnpDiscovery) \
39 EXPAND_CLASS_MEMBER_INT(CLASS, Cookie, void *) \
40 EXPAND_CLASS_MEMBER_INT(CLASS, CtrlptCallback, Upnp_FunPtr) \
45 void SSDPResultData_Callback(
const SSDPResultData *p);
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
int DeviceShutdown(char *DevType, int RootDev, char *Udn, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
Creates a HTTP device shutdown request packet and send it to the multicast channel through RequestHan...
Definition: ssdp_device.c:834
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
int ServiceReply(struct sockaddr *DestAddr, char *ServType, char *Udn, char *Location, int Duration, int PowerState, int SleepPeriod, int RegistrationState)
Creates the advertisement packet based on the input parameter, and send it to the multicast channel.
Definition: ssdp_device.c:757
@ UPNP_DISCOVERY_SEARCH_RESULT
Definition: Callback.h:63
Definition: ssdplib.h:144
Definition: upnp_timeout.h:45
@ UPNP_CONTROL_ACTION_REQUEST
Definition: Callback.h:25
EXPORT_SPEC char * ixmlPrintNode(IXML_Node *doc)
Renders a Node and all sub-elements into an XML text representation.
Definition: ixml.c:365
EXPORT_SPEC IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
Definition: node.c:307
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
Upnp_Handle_Type GetHandleInfo(UpnpClient_Handle Hnd, struct Handle_Info **HndInfo)
Get handle information.
Definition: upnpapi.c:3855
#define SOAP_TIMEOUT
Definition: soap_device.c:60
EXPORT_SPEC void ixmlFreeDOMString(char *buf)
Frees a DOMString.
int ServiceAdvertisement(char *Udn, char *ServType, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
Creates the advertisement packet based on the input parameter, and send it to the multicast channel.
Definition: ssdp_device.c:706
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
static UPNP_INLINE void handle_query_variable(SOCKINFO *info, http_message_t *request, soap_devserv_t *soap_info, IXML_Node *req_node)
Handles the SOAP requests to querry the state variables. This functionality has been deprecated in th...
Definition: soap_device.c:291
int status_code
Definition: httpparser.h:188
Definition: ssdplib.h:136
void(* free_routine)(void *arg)
Definition: ThreadPool.h:135
Definition: httpparser.h:213
@ UPNP_CONTROL_GET_VAR_REQUEST
Definition: Callback.h:36
#define UPNP_E_INVALID_ACTION
The SOAP action message is invalid.
Definition: upnp.h:182
#define UPNP_E_INVALID_PARAM
One or more of the parameters passed to the function is not valid.
Definition: upnp.h:110
struct sockaddr_storage foreign_sockaddr
Definition: sock.h:64
int unique_service_name(char *cmd, SsdpEvent *Evt)
Fills the fields of the event structure like DeviceType, Device UDN and Service Type.
Definition: ssdp_server.c:447
EXPORT_SPEC const char * ixmlNode_getNodeValue(IXML_Node *nodeptr)
Returns the value of the Node as a string.
Definition: node.c:253
char * buf
Definition: membuffer.h:58
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
#define UPNP_E_OUTOF_SOCKET
The SDK cannot create any more sockets.
Definition: upnp.h:287
#define UpnpCloseSocket
Definition: UpnpInet.h:57
int ServiceShutdown(char *Udn, char *ServType, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
Creates a HTTP service shutdown request packet and sends it to the multicast channel through RequestH...
Definition: ssdp_device.c:783
@ PARSE_OK
Definition: httpparser.h:161
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
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
UpnpDiscovery object declararion.
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
Data structure representing the DOM Document.
Definition: ixml.h:198
static int get_mpost_acton_hdrval(http_message_t *request, memptr *val)
Get the SOAPACTION header value for M-POST request.
Definition: soap_device.c:490
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
memptr entity
Definition: httpparser.h:205
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority)
Sets the max threads for the thread pool attributes.
Definition: ThreadPool.c:1083
Definition: membuffer.h:47
void advertiseAndReplyThread(void *data)
Wrapper function to reply the search request coming from the control point.
Definition: ssdp_device.c:67
size_t length
Definition: membuffer.h:51
enum SsdpSearchType ssdp_request_type1(char *cmd)
This function figures out the type of the SSDP search in the in the request.
Definition: ssdp_server.c:533
SSDPResultData object declararion.
static int CreateClientRequestPacket(INOUT char *RqstBuf, IN size_t RqstBufSize, IN int Mx, IN char *SearchTarget, IN int AddressFamily)
Creates a HTTP search request packet depending on the input parameter.
Definition: ssdp_ctrlpt.c:355
uri_type uri
Definition: httpparser.h:184
@ UPNP_DISCOVERY_SEARCH_TIMEOUT
Definition: Callback.h:68
SsdpSearchType
Definition: ssdplib.h:66
UpnpActionRequest object declaration.
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
#define UPNP_E_SUCCESS
The operation completed successfully.
Definition: upnp.h:97
void membuffer_init(membuffer *m)
Wrapper to membuffer_initialize().
Definition: membuffer.c:152
#define UPNP_E_INVALID_ARGUMENT
One or more of the parameters passed to a function is invalid.
Definition: upnp.h:344
#define UPNP_INLINE
Declares an inline function.
Definition: UpnpGlobal.h:99
Definition: soap_device.c:84
int SendReply(struct sockaddr *DestAddr, char *DevType, int RootDev, char *Udn, char *Location, int Duration, int ByType, int PowerState, int SleepPeriod, int RegistrationState)
Creates the reply packet based on the input parameter, and send it to the client addesss given in its...
Definition: ssdp_device.c:579
Definition: membuffer.h:56
#define UPNP_E_INVALID_URL
An URL passed into the function is invalid.
Definition: upnp.h:152
Definition: ssdplib.h:152
static UPNP_INLINE void send_action_response(SOCKINFO *info, IXML_Document *action_resp, http_message_t *request)
Sends the SOAP action response.
Definition: soap_device.c:220
EXPORT_SPEC char * ixmlCloneDOMString(const char *src)
Clones an existing DOMString.
TimerThread gTimerThread
Definition: upnpapi.c:119
#define UPNP_E_NOT_FOUND
The response to a SOAP request did not contain the required XML constructs.
Definition: upnp.h:370
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
EXPORT_SPEC void ixmlDocument_free(IXML_Document *doc)
Frees a Document object and all Nodes associated with it.
Definition: document.c:54
@ SSDP_SERROR
Definition: ssdplib.h:68
char * Cookie
Definition: upnpapi.h:78
char * membuffer_detach(membuffer *m)
Definition: membuffer.c:273
Upnp_Handle_Type GetClientHandleInfo(UpnpClient_Handle *client_handle_out, struct Handle_Info **HndInfo)
Get client handle info.
Definition: upnpapi.c:3760
#define INVALID_SOCKET
Definition: UpnpInet.h:51
static void CreateServicePacket(int msg_type, const char *nt, char *usn, char *location, int duration, char **packet, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
Creates a HTTP request packet. Depending on the input parameter, it either creates a service advertis...
Definition: ssdp_device.c:319
ListNode * ListNext(LinkedList *list, ListNode *node)
Returns the next item in the list.
Definition: LinkedList.c:245
@ UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE
Definition: Callback.h:57
Definition: LinkedList.h:61
ListNode * ListHead(LinkedList *list)
Returns the head of the list.
Definition: LinkedList.c:219
Definition: ssdplib.h:107
int SOCKET
Definition: UpnpInet.h:48
static UPNP_INLINE void send_var_query_response(SOCKINFO *info, const char *var_value, http_message_t *hmsg)
Sends response of get var status.
Definition: soap_device.c:168
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
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
Definition: ThreadPool.h:164
token text
Definition: uri.h:128
Data structure common to all types of nodes.
Definition: ixml.h:173
static int check_soapaction_hdr(http_message_t *request, soap_devserv_t *soap_info)
Check the header validity, and get the action name and the version of the service that the CP wants t...
Definition: soap_device.c:531
char * buf
Definition: membuffer.h:49
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
size_t size_inc
Definition: membuffer.h:64
int DeviceReply(struct sockaddr *DestAddr, char *DevType, int RootDev, char *Udn, char *Location, int Duration, int PowerState, int SleepPeriod, int RegistrationState)
Creates the reply packet based on the input parameter, and send it to the client address given in its...
Definition: ssdp_device.c:643
#define TRUE
Definition: upnputil.h:63
Definition: httpparser.h:179
EXPORT_SPEC const char * ixmlNode_getNamespaceURI(IXML_Node *nodeptr)
Retrieves the namespace URI for a Node as a DOMString.
Definition: node.c:229
static void handle_invoke_action(SOCKINFO *info, http_message_t *request, soap_devserv_t *soap_info, IXML_Node *req_node)
Handles the SOAP action request.
Definition: soap_device.c:352
#define UPNP_E_NETWORK_ERROR
A network error occurred.
Definition: upnp.h:237
static void send_error_response(IN SOCKINFO *info, IN int error_code, IN const char *err_msg, IN http_message_t *hmsg)
Sends SOAP error response.
Definition: soap_device.c:97
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
EXPORT_SPEC const char * ixmlNode_getLocalName(IXML_Node *nodeptr)
Retrieves the local name of a Node, if present.
Definition: node.c:132
Represents a URI used in parse_uri and elsewhere.
Definition: uri.h:136
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
size_t length
Definition: membuffer.h:60
static int extractIPv6address(char *url, char *address)
Definition: ssdp_device.c:263
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
char gIF_IPV4[INET_ADDRSTRLEN]
Definition: upnpapi.c:137
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
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
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func)
Sets the max threads for the thread pool attributes.
Definition: ThreadPool.c:1098
int is_request
Definition: httpparser.h:197
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
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
void ssdp_handle_device_request(http_message_t *hmsg, struct sockaddr_storage *dest_addr)
Handles the search request. It does the sanity checks of the request and then schedules a thread to s...
Definition: ssdp_device.c:80
unsigned gIF_INDEX
Definition: upnpapi.c:149
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
Upnp_FunPtr Callback
Definition: upnpapi.h:76
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
static int isUrlV6UlaGua(char *descdocUrl)
Definition: ssdp_device.c:301
static int check_soap_request(soap_devserv_t *soap_info, IN IXML_Document *xml_doc, IXML_Node **req_node)
Check validity of the SOAP request per UPnP specification.
Definition: soap_device.c:612
@ UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
Definition: Callback.h:51
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
LinkedList SsdpSearchList
Definition: upnpapi.h:120
http_method_t method
Definition: httpparser.h:182
int DeviceAdvertisement(char *DevType, int RootDev, char *Udn, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
Creates the device advertisement request based on the input parameter, and send it to the multicast c...
Definition: ssdp_device.c:495
Templates for include files of objects.
#define UPNP_E_INTERNAL_ERROR
Generic error code for internal conditions not covered by other error codes.
Definition: upnp.h:376
@ REL_SEC
Definition: TimerThread.h:55
#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
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
Provides a platform independent way to include TCP/IP types and functions.
void membuffer_destroy(membuffer *m)
Free's memory allocated for membuffer* m.
Definition: membuffer.c:160
static int NewRequestHandler(struct sockaddr *DestAddr, int NumPacket, char **RqPacket)
Works as a request handler which passes the HTTP request string to multicast channel.
Definition: ssdp_device.c:176
ThreadPool gRecvThreadPool
Definition: upnpapi.c:125
#define UPNP_E_SOCKET_WRITE
An error happened while writing to a socket.
Definition: upnp.h:247
EXPORT_SPEC IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
Definition: node.c:346
static int get_dev_service(http_message_t *request, int AddressFamily, soap_devserv_t *soap_info)
Retrieve SOAP device/service information associated with request-URI, which includes the callback fun...
Definition: soap_device.c:442
void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_addr, int timeout)
This function handles the ssdp messages from the devices. These messages includes the search replies,...
Definition: ssdp_ctrlpt.c:78
static void send_search_result(IN void *data)
Sends a callback to the control point application with a SEARCH result.
Definition: ssdp_ctrlpt.c:68
Definition: service_table.h:74
#define UPNP_E_OUTOF_MEMORY
Not enough resources are currently available to complete the operation.
Definition: upnp.h:126
size_t UpnpString_get_Length(const UpnpString *p)
Returns the length of the string.
Definition: UpnpString.c:145
int ssdp_request_type(char *cmd, SsdpEvent *Evt)
Starts filling the SSDP event structure based upon the request received.
Definition: ssdp_server.c:548