peer.h File Reference

Peer API. More...

#include <lwmsg/status.h>
#include <lwmsg/protocol.h>
#include <lwmsg/time.h>
#include <lwmsg/assoc.h>
#include <lwmsg/message.h>
#include <lwmsg/call.h>

Macros

#define LWMSG_DISPATCH_BLOCK(tag, func)
 Define blocking message handler. More...
 
#define LWMSG_DISPATCH_NONBLOCK(tag, func)
 Define non-blocking message handler. More...
 
#define LWMSG_DISPATCH_END
 Terminate dispatch table. More...
 

Typedefs

typedef struct
LWMsgDispatchSpec const 
LWMsgDispatchSpec
 Dispatch specification. More...
 
typedef struct LWMsgPeer LWMsgPeer
 Peer structure. More...
 
typedef LWMsgStatus(* LWMsgPeerCallFunction )(LWMsgCall *call, const LWMsgParams *in, LWMsgParams *out, void *data)
 Call handler function. More...
 
typedef void(* LWMsgPeerExceptionFunction )(LWMsgPeer *peer, LWMsgStatus status, void *data)
 Exception handler function. More...
 
typedef void(* LWMsgPeerTraceFunction )(LWMsgCall *call, const LWMsgParams *params, LWMsgStatus status, void *data)
 Call trace function. More...
 

Functions

LWMsgStatus lwmsg_peer_new (const LWMsgContext *context, LWMsgProtocol *protocol, LWMsgPeer **peer)
 Create a new peer object. More...
 
void lwmsg_peer_delete (LWMsgPeer *peer)
 Delete a peer object. More...
 
LWMsgStatus lwmsg_peer_set_timeout (LWMsgPeer *peer, LWMsgTimeout type, LWMsgTime *value)
 Set timeout. More...
 
LWMsgStatus lwmsg_peer_set_max_listen_clients (LWMsgPeer *peer, unsigned int max_clients)
 Set maximum number of simultaneous incoming associations. More...
 
LWMsgStatus lwmsg_peer_set_max_listen_backlog (LWMsgPeer *peer, unsigned int max_backlog)
 Set maximum number of backlogged associations. More...
 
LWMsgStatus lwmsg_peer_add_dispatch_spec (LWMsgPeer *peer, LWMsgDispatchSpec *spec)
 Add a message dispatch specification. More...
 
LWMsgStatus lwmsg_peer_add_listen_fd (LWMsgPeer *peer, LWMsgEndpointType type, int fd)
 Add listen socket. More...
 
LWMsgStatus lwmsg_peer_add_listen_endpoint (LWMsgPeer *peer, LWMsgEndpointType type, const char *endpoint, mode_t permissions)
 Add listening endpoint. More...
 
LWMsgStatus lwmsg_peer_set_listen_session_functions (LWMsgPeer *peer, LWMsgSessionConstructFunction construct, LWMsgSessionDestructFunction destruct, void *data)
 Set session construct and destruct functions for incoming clients. More...
 
LWMsgStatus lwmsg_peer_set_dispatch_data (LWMsgPeer *peer, void *data)
 Set dispatch data pointer. More...
 
void * lwmsg_peer_get_dispatch_data (LWMsgPeer *peer)
 Get dispatch data pointer. More...
 
LWMsgStatus lwmsg_peer_start_listen (LWMsgPeer *peer)
 Start listening for incoming associations. More...
 
LWMsgStatus lwmsg_peer_stop_listen (LWMsgPeer *peer)
 Stop listening for incoming assocations. More...
 
LWMsgStatus lwmsg_peer_set_exception_function (LWMsgPeer *peer, LWMsgPeerExceptionFunction except, void *except_data)
 Set exception handler. More...
 
LWMsgStatus lwmsg_peer_set_trace_functions (LWMsgPeer *peer, LWMsgPeerTraceFunction begin, LWMsgPeerTraceFunction end, void *data)
 Set trace functions. More...
 
LWMsgStatus lwmsg_peer_add_connect_endpoint (LWMsgPeer *peer, LWMsgEndpointType type, const char *endpoint)
 Add connection endpoint. More...
 
LWMsgStatus lwmsg_peer_connect (LWMsgPeer *peer, LWMsgSession **session)
 Create outgoing session. More...
 
LWMsgStatus lwmsg_peer_disconnect (LWMsgPeer *peer)
 Close outgoing session. More...
 
LWMsgStatus lwmsg_peer_connect_fd (LWMsgPeer *peer, LWMsgEndpointType type, int fd, LWMsgSession **session)
 Establish session on existing fd. More...
 
LWMsgStatus lwmsg_peer_accept_fd (LWMsgPeer *peer, LWMsgEndpointType type, int fd)
 Accept session on existing fd. More...
 
LWMsgStatus lwmsg_peer_acquire_call (LWMsgPeer *peer, LWMsgCall **call)
 Acquire outgoing call handle [DEPRECATED]. More...