Callback.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Typedefs

typedef enum Upnp_EventType_e | Upnp_EventType
typedef int(* | Upnp_FunPtr) (Upnp_EventType EventType, const void *Event, void *Cookie)

## Enumerations

enum

Upnp_EventType_e {
UPNP_CONTROL_ACTION_REQUEST, UPNP_CONTROL_ACTION_COMPLETE, UPNP_CONTROL_GET_VAR_REQUEST, UPNP_CONTROL_GET_VAR_COMPLETE,
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE, UPNP_DISCOVERY_SEARCH_RESULT, UPNP_DISCOVERY_SEARCH_TIMEOUT,
UPNP_EVENT_SUBSCRIPTION_REQUEST, UPNP_EVENT_RECEIVED, UPNP_EVENT_RENEWAL_COMPLETE, UPNP_EVENT_SUBSCRIBE_COMPLETE,
UPNP_EVENT_UNSUBSCRIBE_COMPLETE, UPNP_EVENT_AUTORENEWAL_FAILED, UPNP_EVENT_SUBSCRIPTION_EXPIRED
}

| The reason code for an event callback. More...

## Typedef Documentation

## Upnp_FunPtr

typedef int(* Upnp_FunPtr) ( Upnp_EventType EventType, const void *Event, void *Cookie)

All callback functions share the same prototype, documented below. Note that any memory passed to the callback function is valid only during the callback and should be copied if it needs to persist. This callback function needs to be thread safe. The context of the callback is always on a valid thread context and standard synchronization methods can be used. Note, however, because of this the callback cannot call SDK functions unless explicitly noted.

      int CallbackFxn(Upnp_EventType EventType, void *Event, void *Cookie);

where EventType is the event that triggered the callback, Event is a structure that denotes event-specific information for that event, and Cookie is the user data passed when the callback was registered.

See Upnp_EventType for more information on the callback values and the associated Event parameter.

The return value of the callback is currently ignored. It may be used in the future to communicate results back to the SDK.

## Enumeration Type Documentation

## Upnp_EventType_e

enum Upnp_EventType_e

The reason code for an event callback.

The Event parameter will be different depending on the reason for the callback. The descriptions for each event type describe the contents of the Event parameter.

Enumerator
UPNP_CONTROL_ACTION_REQUEST | Received by a device when a control point issues a control request. The Event parameter contains a pointer to a UpnpActionRequest structure containing the action. The application stores the results of the action in this structure.
UPNP_CONTROL_ACTION_COMPLETE | A UpnpSendActionAsync call completed. The Event parameter contains a pointer to a UpnpActionComplete structure with the results of the action.
UPNP_CONTROL_GET_VAR_REQUEST | Received by a device when a query for a single service variable arrives. The Event parameter contains a pointer to a UpnpStateVarRequest structure containing the name of the variable and value.
UPNP_CONTROL_GET_VAR_COMPLETE | A UpnpGetServiceVarStatus call completed. The Event parameter contains a pointer to a UpnpStateVarComplete structure containing the value for the variable.
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE | Received by a control point when a new device or service is available. The Event parameter contains a pointer to a UpnpDiscovery structure with the information about the device or service.
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE | Received by a control point when a device or service shuts down. The Event parameter contains a pointer to a UpnpDiscovery structure containing the information about the device or service.
UPNP_DISCOVERY_SEARCH_RESULT | Received by a control point when a matching device or service responds. The Event parameter contains a pointer to a UpnpDiscovery structure containing the information about the reply to the search request.
UPNP_DISCOVERY_SEARCH_TIMEOUT | Received by a control point when the search timeout expires. The SDK generates no more callbacks for this search after this event. The Event parameter is `NULL`.

UPNP_EVENT_SUBSCRIPTION_REQUEST

Received by a device when a subscription arrives. The Event parameter contains a pointer to a UpnpSubscriptionRequest structure. At this point, the subscription has already been accepted. UpnpAcceptSubscription needs to be called to confirm the subscription and transmit the initial state table. This can be done during this callback. The SDK generates no events for a subscription unless the device application calls UpnpAcceptSubscription.

UPNP_EVENT_RECEIVED | Received by a control point when an event arrives. The Event parameter contains a UpnpEvent structure with the information about the event.
UPNP_EVENT_RENEWAL_COMPLETE | A UpnpRenewSubscriptionAsync call completed. The status of the renewal is in the Event parameter as a Upnp_Event_Subscription structure.
UPNP_EVENT_SUBSCRIBE_COMPLETE | A UpnpSubscribeAsync call completed. The status of the subscription is in the Event parameter as a Upnp_Event_Subscription structure.
UPNP_EVENT_UNSUBSCRIBE_COMPLETE | A UpnpUnSubscribeAsync call completed. The status of the subscription is in the Event parameter as a UpnpEventSubscribe structure.
UPNP_EVENT_AUTORENEWAL_FAILED | The auto-renewal of a client subscription failed. The Event parameter is a UpnpEventSubscribe structure with the error code set appropriately. The subscription is no longer valid.
UPNP_EVENT_SUBSCRIPTION_EXPIRED | A client subscription has expired. This will only occur if auto-renewal of subscriptions is disabled. The Event parameter is a UpnpEventSubscribe structure. The subscription is no longer valid.