upnp/src/gena/gena_device.c
static int genaNotify(
	/*! [in] Null terminated, includes all headers (including \\r\\n) except SID and SEQ. */
	char *headers,
	/*! [in] The evented XML. */
	char *propertySet,
	/*! [in] subscription to be Notified, assumes this is valid for life of function. */
	subscription *sub)
{
	size_t i;
	membuffer mid_msg;
	uri_type *url;
	http_parser_t response;
	int return_code = -1;

	membuffer_init(&mid_msg);
	if (http_MakeMessage(&mid_msg, 1, 1,
			     "s" "ssc" "sdcc",
			     headers,
			     "SID: ", sub->sid,
			     "SEQ: ", sub->ToSendEventKey) != 0) {
		membuffer_destroy(&mid_msg);
		return UPNP_E_OUTOF_MEMORY;
	}
	/* send a notify to each url until one goes thru */
	for (i = 0; i < sub->DeliveryURLs.size; i++) {
		url = &sub->DeliveryURLs.parsedURLs[i];
		return_code = notify_send_and_recv(
			url, &mid_msg, propertySet, &response);
		if (return_code == UPNP_E_SUCCESS)
			break;
	}
	membuffer_destroy(&mid_msg);
	if (return_code == UPNP_E_SUCCESS) {
		if (response.msg.status_code == HTTP_OK)
			return_code = GENA_SUCCESS;
		else {
			if (response.msg.status_code == HTTP_PRECONDITION_FAILED)
				/*Invalid SID gets removed */
				return_code = GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB;
			else
				return_code = GENA_E_NOTIFY_UNACCEPTED;
		}
		httpmsg_destroy(&response.msg);
	}

	return return_code;
}
/*!
 * \brief Function to Notify a particular subscription of a particular event.
 *
 * In general the service should NOT be blocked around this call (this may
 * cause deadlock with a client).
 *
 * NOTIFY http request is sent and the reply is processed.
 *
 * \return GENA_SUCCESS if the event was delivered, otherwise returns the
 * 	appropriate error code.
 */
\brief Function to Notify a particular subscription of a particular event.
In general the service should NOT be blocked around this call (this may
cause deadlock with a client).

NOTIFY http request is sent and the reply is processed.

\return GENA_SUCCESS if the event was delivered, otherwise returns the
appropriate error code.
\ brief Function to Notify a particular subscription of a particular event . In general the service should NOT be blocked around this call ( this may cause deadlock with a client ) . NOTIFY http request is sent and the reply is processed . \ return GENA_SUCCESS if the event was delivered otherwise returns the appropriate error code .
static int genaNotify(
	char *headers,
	char *propertySet,
	subscription *sub)
{
	size_t i;
	membuffer mid_msg;
	uri_type *url;
	http_parser_t response;
	int return_code = -1;
	membuffer_init(&mid_msg);
	if (http_MakeMessage(&mid_msg, 1, 1,
			     "s" "ssc" "sdcc",
			     headers,
			     "SID: ", sub->sid,
			     "SEQ: ", sub->ToSendEventKey) != 0) {
		membuffer_destroy(&mid_msg);
		return UPNP_E_OUTOF_MEMORY;
	}
	for (i = 0; i < sub->DeliveryURLs.size; i++) {
		url = &sub->DeliveryURLs.parsedURLs[i];
		return_code = notify_send_and_recv(
			url, &mid_msg, propertySet, &response);
		if (return_code == UPNP_E_SUCCESS)
			break;
	}
	membuffer_destroy(&mid_msg);
	if (return_code == UPNP_E_SUCCESS) {
		if (response.msg.status_code == HTTP_OK)
			return_code = GENA_SUCCESS;
		else {
			if (response.msg.status_code == HTTP_PRECONDITION_FAILED)
				return_code = GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB;
			else
				return_code = GENA_E_NOTIFY_UNACCEPTED;
		}
		httpmsg_destroy(&response.msg);
	}
	return return_code;
}
static int genaNotify ( char * headers , char * propertySet , subscription * sub ) { size_t i ; membuffer mid_msg ; uri_type * url ; http_parser_t response ; int return_code = -1 ; membuffer_init ( & mid_msg ) ; if ( http_MakeMessage ( & mid_msg , 1 , 1 , " " " " " " , headers , " " , sub -> sid , " " , sub -> ToSendEventKey ) != 0 ) { membuffer_destroy ( & mid_msg ) ; return UPNP_E_OUTOF_MEMORY ; } for ( i = 0 ; i < sub -> DeliveryURLs . size ; i ++ ) { url = & sub -> DeliveryURLs . parsedURLs [ i ] ; return_code = notify_send_and_recv ( url , & mid_msg , propertySet , & response ) ; if ( return_code == UPNP_E_SUCCESS ) break ; } membuffer_destroy ( & mid_msg ) ; if ( return_code == UPNP_E_SUCCESS ) { if ( response . msg . status_code == HTTP_OK ) return_code = GENA_SUCCESS ; else { if ( response . msg . status_code == HTTP_PRECONDITION_FAILED ) return_code = GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB ; else return_code = GENA_E_NOTIFY_UNACCEPTED ; } httpmsg_destroy ( & response . msg ) ; } return return_code ; }
\brief Function to Notify a particular subscription of a particular event.
\ brief Function to Notify a particular subscription of a particular event .
/*! [in] Null terminated, includes all headers (including \\r\\n) except SID and SEQ. */ /*! [in] The evented XML. */ /*! [in] subscription to be Notified, assumes this is valid for life of function. */ /* send a notify to each url until one goes thru */ /*Invalid SID gets removed */