Unsettled API - A listener for incoming connections. More...
Typedefs | |
typedef struct pn_listener_t | pn_listener_t |
A listener for incoming connections. | |
Functions | |
PNP_EXTERN pn_listener_t * | pn_listener (void) |
Create a listener to pass to pn_proactor_listen() More... | |
PNP_EXTERN void | pn_listener_free (pn_listener_t *l) |
Free a listener. More... | |
PNP_EXTERN void | pn_listener_accept2 (pn_listener_t *listener, pn_connection_t *connection, pn_transport_t *transport) |
Accept an incoming connection request using transport and connection , which can be configured before the call. More... | |
PNP_EXTERN void | pn_listener_accept (pn_listener_t *listener, pn_connection_t *connection) |
Deprecated - Use pn_listener_accept2(). | |
PNP_EXTERN pn_condition_t * | pn_listener_condition (pn_listener_t *l) |
Get the error condition for a listener. | |
PNP_EXTERN void * | pn_listener_get_context (pn_listener_t *listener) |
Get the application context associated with this listener object. More... | |
PNP_EXTERN void | pn_listener_set_context (pn_listener_t *listener, void *context) |
Set a new application context for a listener object. More... | |
PNP_EXTERN pn_record_t * | pn_listener_attachments (pn_listener_t *listener) |
Get the attachments that are associated with a listener object. | |
PNP_EXTERN void | pn_listener_close (pn_listener_t *l) |
Close the listener. More... | |
PNP_EXTERN pn_proactor_t * | pn_listener_proactor (pn_listener_t *c) |
The proactor associated with a listener. | |
PNP_EXTERN pn_listener_t * | pn_event_listener (pn_event_t *event) |
Return the listener associated with an event. More... | |
PNP_EXTERN void | pn_listener_raw_accept (pn_listener_t *listener, pn_raw_connection_t *raw_connection) |
Accept an incoming connection request as a raw connection. More... | |
Unsettled API - A listener for incoming connections.
PNP_EXTERN pn_listener_t* pn_listener | ( | void | ) |
Create a listener to pass to pn_proactor_listen()
You can use pn_listener_attachments() to set application data that can be accessed when accepting connections.
PNP_EXTERN void pn_listener_free | ( | pn_listener_t * | l | ) |
Free a listener.
You don't need to call this unless you create a listener with pn_listen() but never pass it to pn_proactor_listen()
PNP_EXTERN void pn_listener_accept2 | ( | pn_listener_t * | listener, |
pn_connection_t * | connection, | ||
pn_transport_t * | transport | ||
) |
Accept an incoming connection request using transport
and connection
, which can be configured before the call.
Call after a PN_LISTENER_ACCEPT event.
Errors are returned as PN_TRANSPORT_CLOSED events by pn_proactor_wait().
[in] | listener | the listener |
[in] | connection | If NULL a new connection is created. Memory management is the same as for pn_proactor_connect2() |
[in] | transport | If NULL a new transport is created. Memory management is the same as for pn_proactor_connect2() |
PNP_EXTERN void* pn_listener_get_context | ( | pn_listener_t * | listener | ) |
Get the application context associated with this listener object.
The application context for a connection may be set using pn_listener_set_context.
[in] | listener | the listener whose context is to be returned. |
PNP_EXTERN void pn_listener_set_context | ( | pn_listener_t * | listener, |
void * | context | ||
) |
Set a new application context for a listener object.
The application context for a listener object may be retrieved using pn_listener_get_context.
[in] | listener | the listener object |
[in] | context | the application context |
PNP_EXTERN void pn_listener_close | ( | pn_listener_t * | l | ) |
Close the listener.
The PN_LISTENER_CLOSE event is generated when the listener has stopped listening.
PNP_EXTERN pn_listener_t* pn_event_listener | ( | pn_event_t * | event | ) |
PNP_EXTERN void pn_listener_raw_accept | ( | pn_listener_t * | listener, |
pn_raw_connection_t * | raw_connection | ||
) |
Accept an incoming connection request as a raw connection.
Call after a PN_LISTENER_ACCEPT event.
Errors are returned as PN_RAW_CONNECTION_DISCONNECTED by pn_proactor_wait().
[in] | listener | the listener |
[in] | raw_connection | the application must create a raw connection with pn_raw_connection() this parameter cannot be null.If NULL a new connection is created. |
The proactor that owns the listener
takes ownership of raw_connection
and will automatically call pn_raw_connection_free() after the final PN_RAW_CONNECTION_DISCONNECTED event is handled, or when pn_proactor_free() is called.