55 #define EXTERN_C extern "C"
66 #define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
67 #define XML_PROPERTYSET_HEADER \
68 "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
70 #define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
71 #define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
72 #define UNABLE_SERVICE_NOT_ACCEPT "HTTP/1.1 503 Service Not Available\r\n\r\n"
74 #define NOT_IMPLEMENTED "HTTP/1.1 501 Not Implemented\r\n\r\n"
75 #define BAD_REQUEST "HTTP/1.1 400 Bad Request\r\n\r\n"
76 #define INVALID_NT BAD_CALLBACK
77 #define BAD_CALLBACK "HTTP/1.1 412 Precondition Failed\r\n\r\n"
78 #define HTTP_OK_CRLF "HTTP/1.1 200 OK\r\n\r\n"
79 #define HTTP_OK_STR "HTTP/1.1 200 OK\r\n"
80 #define INVALID_SID BAD_CALLBACK
81 #define MISSING_SID BAD_CALLBACK
82 #define MAX_CONTENT_LENGTH 20
83 #define MAX_SECONDS 10
85 #define MAX_PORT_SIZE 10
87 #define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
88 #define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
89 #define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
90 #define GENA_E_BAD_SID UPNP_E_INVALID_SID
91 #define GENA_E_UNSUBSCRIBE_UNACCEPTED UPNP_E_UNSUBSCRIBE_UNACCEPTED
92 #define GENA_E_NOTIFY_UNACCEPTED UPNP_E_NOTIFY_UNACCEPTED
93 #define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
94 #define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
97 #define XML_SUCCESS UPNP_E_SUCCESS
98 #define GENA_SUCCESS UPNP_E_SUCCESS
100 #define CALLBACK_SUCCESS 0
101 #define DEFAULT_TIMEOUT 1801
108 #define SubscribeLock() \
110 UPNP_INFO, GENA, __FILE__, __LINE__, "Trying Subscribe Lock"); \
111 ithread_mutex_lock(&GlobalClientSubscribeMutex); \
112 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "Subscribe Lock");
117 #define SubscribeUnlock() \
118 UpnpPrintf(UPNP_INFO, \
122 "Trying Subscribe UnLock"); \
123 ithread_mutex_unlock(&GlobalClientSubscribeMutex); \
124 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "Subscribe UnLock");
137 int *reference_count;
165 #ifdef INCLUDE_CLIENT_APIS
190 #ifdef INCLUDE_CLIENT_APIS
207 #ifdef INCLUDE_CLIENT_APIS
222 #ifdef INCLUDE_DEVICE_APIS
238 #ifdef INCLUDE_CLIENT_APIS
257 #ifdef INCLUDE_DEVICE_APIS
281 #ifdef INCLUDE_DEVICE_APIS
301 #ifdef INCLUDE_DEVICE_APIS
329 #ifdef INCLUDE_DEVICE_APIS
int genaRenewSubscription(UpnpClient_Handle client_handle, const UpnpString *in_sid, int *TimeOut)
Renews a SID.
Definition: gena_ctrlpt.c:654
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:429
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.
Definition: gena_callback2.c:58
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:560
Definition: httpparser.h:181
struct NOTIFY_THREAD_STRUCT notify_thread_struct
UpnpDevice_Handle device_handle
Definition: tv_device.c:77
int genaUnSubscribe(UpnpClient_Handle client_handle, const UpnpString *in_sid)
Unsubscribes a SID.
Definition: gena_ctrlpt.c:511
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:660
UpnpString object declaration.
int genaUnregisterClient(UpnpClient_Handle client_handle)
Unsubcribes all the outstanding subscriptions and cleans the subscription list.
Definition: gena_ctrlpt.c:466
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.
Definition: gena_callback2.c:84
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnp.h:439
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:711
ithread_mutex_t GlobalClientSubscribeMutex
Definition: upnpapi.c:116
#define DOMString
The type of DOM strings.
Definition: ixml.h:48
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:1004
int genaUnregisterDevice(UpnpDevice_Handle device_handle)
Cleans the service table of the device.
Definition: gena_device.c:64
Definition: httpparser.h:216
Data structure representing the DOM Document.
Definition: ixml.h:159
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:33
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:448
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:961