54 #define MW_SERVICE(srv) ((struct mwService *) srv)
57 #define MW_SERVICE_IS_STATE(srvc, state) \
58 (mwService_getState(MW_SERVICE(srvc)) == (state))
60 #define MW_SERVICE_IS_STOPPED(srvc) \
61 MW_SERVICE_IS_STATE(srvc, mwServiceState_STOPPED)
63 #define MW_SERVICE_IS_STOPPING(srvc) \
64 MW_SERVICE_IS_STATE(srvc, mwServiceState_STOPPING)
66 #define MW_SERVICE_IS_STARTED(srvc) \
67 MW_SERVICE_IS_STATE(srvc, mwServiceState_STARTED)
69 #define MW_SERVICE_IS_STARTING(srvc) \
70 MW_SERVICE_IS_STATE(srvc, mwServiceState_STARTING)
74 #define MW_SERVICE_IS_LIVE(srvc) \
75 (MW_SERVICE_IS_STARTING(srvc) || MW_SERVICE_IS_STARTED(srvc))
78 #define MW_SERVICE_IS_DEAD(srvc) \
79 (MW_SERVICE_IS_STOPPING(srvc) || MW_SERVICE_IS_STOPPED(srvc))
88 typedef const char *(*mwService_funcGetName)(
struct mwService *service);
90 typedef const char *(*mwService_funcGetDesc)(
struct mwService *service);
230 guint32 service_type);
349 gpointer data, GDestroyNotify cleanup);
mwService_funcClear clear
The service's cleanup handler.
Definition: mw_service.h:195
mwService_funcRecvCreate recv_create
The service's channel create handler.
Definition: mw_service.h:154
error determining state
Definition: mw_service.h:49
const char *(* mwService_funcGetName)(struct mwService *service)
Definition: mw_service.h:88
Definition: mw_message.h:183
Definition: mw_message.h:210
void(* mwService_funcRecvCreate)(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelCreate *msg)
Definition: mw_service.h:94
void mwService_recvCreate(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelCreate *msg)
Triggers the recv_create handler on the service.
void mwService_init(struct mwService *service, struct mwSession *session, guint32 service_type)
Prepares a newly allocated service for use.
guint32 type
the unique identifier by which this service is registered.
Definition: mw_service.h:128
mwService_funcStop stop
The service's stop handler.
Definition: mw_service.h:186
void mwService_setClientData(struct mwService *service, gpointer data, GDestroyNotify cleanup)
Associates client data with service.
void mwService_free(struct mwService *service)
Frees memory used by a service.
void mwService_recvDestroy(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelDestroy *msg)
Triggers the recv_destroy handler on the service.
mwService_funcGetDesc get_desc
Definition: mw_service.h:147
void mwService_start(struct mwService *service)
Triggers the start handler for the service.
Represents a Sametime client session.
void mwService_stop(struct mwService *service)
Triggers the stop handler for the service.
void(* mwService_funcStart)(struct mwService *service)
Definition: mw_service.h:82
mwService_funcRecvDestroy recv_destroy
The service's channel destroy handler.
Definition: mw_service.h:168
Common data types and functions for handling those types.
mwService_funcRecv recv
The service's input handler.
Definition: mw_service.h:174
void mwService_started(struct mwService *service)
Indicate that a service is started.
struct mwSession * session
session this service is attached to.
Definition: mw_service.h:139
const char * mwService_getDesc(struct mwService *)
Definition: mw_message.h:238
the service is starting up
Definition: mw_service.h:47
void(* mwService_funcRecv)(struct mwService *service, struct mwChannel *channel, guint16 msg_type, struct mwOpaque *data)
Definition: mw_service.h:111
error in service, shutting down
Definition: mw_service.h:48
void mwService_recvAccept(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelAccept *msg)
Triggers the recv_accept handler on the service.
GDestroyNotify client_cleanup
Optional client data cleanup function.
Definition: mw_service.h:208
A service is the recipient of sendOnCnl messages sent over channels marked with the corresponding ser...
Definition: mw_service.h:123
guint32 mwService_getType(struct mwService *)
void mwService_recv(struct mwService *service, struct mwChannel *channel, guint16 msg_type, struct mwOpaque *data)
Triggers the input handler on the service.
enum mwServiceState mwService_getState(struct mwService *service)
Represents a channel to a service.
Definition: mw_channel.h:95
the service is not active
Definition: mw_service.h:44
void(* mwService_funcRecvAccept)(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelAccept *msg)
Definition: mw_service.h:100
mwService_funcStart start
The service's start handler.
Definition: mw_service.h:180
gpointer mwService_getClientData(struct mwService *service)
Reference associated client data.
void mwService_stopped(struct mwService *service)
Indicate that a service is stopped.
A length of binary data, not null-terminated.
Definition: mw_common.h:79
void(* mwService_funcRecvDestroy)(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelDestroy *msg)
Definition: mw_service.h:106
void(* mwService_funcClear)(struct mwService *service)
Definition: mw_service.h:86
const char *(* mwService_funcGetDesc)(struct mwService *service)
Definition: mw_service.h:90
gpointer client_data
Optional client data, not for use by service implementations.
Definition: mw_service.h:201
enum mwServiceState state
the state of this service.
Definition: mw_service.h:135
mwServiceState
State-tracking for a service.
Definition: mw_service.h:43
the service is active
Definition: mw_service.h:46
mwService_funcGetName get_name
Definition: mw_service.h:143
const char * mwService_getName(struct mwService *)
void mwService_removeClientData(struct mwService *service)
Removes client data from service.
mwService_funcRecvAccept recv_accept
The service's channel accept handler.
Definition: mw_service.h:161
guchar * data
data, normally with no NULL termination
Definition: mw_common.h:81
the service is shutting down
Definition: mw_service.h:45
struct mwSession * mwService_getSession(struct mwService *service)
void(* mwService_funcStop)(struct mwService *service)
Definition: mw_service.h:84