|
meanwhile 1.1.1
|
#include "mw_common.h"Go to the source code of this file.
Data Structures | |
| struct | mwService |
| A service is the recipient of sendOnCnl messages sent over channels marked with the corresponding service id. More... | |
Macros | |
| #define | MW_SERVICE(srv) |
| Casts a concrete service (such as mwServiceAware) into a mwService. | |
| #define | MW_SERVICE_IS_DEAD(srvc) |
| If a service is STOPPING or STOPPED, it's considered DEAD. | |
| #define | MW_SERVICE_IS_LIVE(srvc) |
| If a service is STARTING or STARTED, it's considered LIVE. | |
| #define | MW_SERVICE_IS_STARTED(srvc) |
| #define | MW_SERVICE_IS_STARTING(srvc) |
| #define | MW_SERVICE_IS_STATE(srvc, state) |
| #define | MW_SERVICE_IS_STOPPED(srvc) |
| #define | MW_SERVICE_IS_STOPPING(srvc) |
Typedefs | |
| typedef void(*) | mwService_funcClear(struct mwService *service) |
| typedef const char *(*) | mwService_funcGetDesc(struct mwService *service) |
| typedef const char *(*) | mwService_funcGetName(struct mwService *service) |
| typedef void(*) | mwService_funcRecv(struct mwService *service, struct mwChannel *channel, guint16 msg_type, struct mwOpaque *data) |
| typedef void(*) | mwService_funcRecvAccept(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelAccept *msg) |
| typedef void(*) | mwService_funcRecvCreate(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelCreate *msg) |
| typedef void(*) | mwService_funcRecvDestroy(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelDestroy *msg) |
| typedef void(*) | mwService_funcStart(struct mwService *service) |
| typedef void(*) | mwService_funcStop(struct mwService *service) |
Enumerations | |
| enum | mwServiceState { mwServiceState_STOPPED , mwServiceState_STOPPING , mwServiceState_STARTED , mwServiceState_STARTING , mwServiceState_ERROR , mwServiceState_UNKNOWN } |
| State-tracking for a service. More... | |
Functions | |
Service Extension API | |
These functions are for use by service implementations | |
| void | mwService_init (struct mwService *service, struct mwSession *session, guint32 service_type) |
| Prepares a newly allocated service for use. | |
| void | mwService_started (struct mwService *service) |
| Indicate that a service is started. | |
| void | mwService_stopped (struct mwService *service) |
| Indicate that a service is stopped. | |
General Services API | |
These functions provide unified access to the general functions of a client service, with some simple sanity-checking. | |
| void | mwService_free (struct mwService *service) |
| Frees memory used by a service. | |
| gpointer | mwService_getClientData (struct mwService *service) |
| Reference associated client data. | |
| const char * | mwService_getDesc (struct mwService *) |
| const char * | mwService_getName (struct mwService *) |
| struct mwSession * | mwService_getSession (struct mwService *service) |
| enum mwServiceState | mwService_getState (struct mwService *service) |
| 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. | |
| void | mwService_recvAccept (struct mwService *service, struct mwChannel *channel, struct mwMsgChannelAccept *msg) |
| Triggers the recv_accept handler on the service. | |
| void | mwService_recvCreate (struct mwService *service, struct mwChannel *channel, struct mwMsgChannelCreate *msg) |
| Triggers the recv_create handler on the service. | |
| void | mwService_recvDestroy (struct mwService *service, struct mwChannel *channel, struct mwMsgChannelDestroy *msg) |
| Triggers the recv_destroy handler on the service. | |
| void | mwService_removeClientData (struct mwService *service) |
| Removes client data from service. | |
| void | mwService_setClientData (struct mwService *service, gpointer data, GDestroyNotify cleanup) |
| Associates client data with service. | |
| void | mwService_start (struct mwService *service) |
| Triggers the start handler for the service. | |
| void | mwService_stop (struct mwService *service) |
| Triggers the stop handler for the service. | |
| #define MW_SERVICE | ( | srv | ) |
Casts a concrete service (such as mwServiceAware) into a mwService.
| #define MW_SERVICE_IS_DEAD | ( | srvc | ) |
If a service is STOPPING or STOPPED, it's considered DEAD.
| #define MW_SERVICE_IS_LIVE | ( | srvc | ) |
If a service is STARTING or STARTED, it's considered LIVE.
| #define MW_SERVICE_IS_STARTED | ( | srvc | ) |
| #define MW_SERVICE_IS_STARTING | ( | srvc | ) |
| #define MW_SERVICE_IS_STATE | ( | srvc, | |
| state ) |
| #define MW_SERVICE_IS_STOPPED | ( | srvc | ) |
| #define MW_SERVICE_IS_STOPPING | ( | srvc | ) |
| typedef void(*) mwService_funcClear(struct mwService *service) |
| typedef const char *(*) mwService_funcGetDesc(struct mwService *service) |
| typedef const char *(*) mwService_funcGetName(struct mwService *service) |
| typedef void(*) mwService_funcRecv(struct mwService *service, struct mwChannel *channel, guint16 msg_type, struct mwOpaque *data) |
| typedef void(*) mwService_funcRecvAccept(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelAccept *msg) |
| typedef void(*) mwService_funcRecvCreate(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelCreate *msg) |
| typedef void(*) mwService_funcRecvDestroy(struct mwService *service, struct mwChannel *channel, struct mwMsgChannelDestroy *msg) |
| typedef void(*) mwService_funcStart(struct mwService *service) |
| typedef void(*) mwService_funcStop(struct mwService *service) |
| enum mwServiceState |
State-tracking for a service.
| void mwService_free | ( | struct mwService * | service | ) |
Frees memory used by a service.
Will trigger the stop handler if the service is STARTED or STARTING. Triggers clear handler to allow cleanup.
| service | The service to clear and free |
References mwService_free().
Referenced by mwService_free().
| gpointer mwService_getClientData | ( | struct mwService * | service | ) |
Reference associated client data.
References mwService_getClientData().
Referenced by mwService_getClientData().
| const char * mwService_getDesc | ( | struct mwService * | ) |
References mwService_getDesc().
Referenced by mwService_getDesc().
| const char * mwService_getName | ( | struct mwService * | ) |
References mwService_getName().
Referenced by mwService_getName().
References mwService_getSession().
Referenced by mwService_getSession().
| enum mwServiceState mwService_getState | ( | struct mwService * | service | ) |
| guint32 mwService_getType | ( | struct mwService * | ) |
References mwService_getType().
Referenced by mwService_getType().
| void mwService_init | ( | struct mwService * | service, |
| struct mwSession * | session, | ||
| guint32 | service_type ) |
Prepares a newly allocated service for use.
Intended for use by service implementations, rather than by code utilizing a service.
The service state will be initialized to STOPPED.
| service | the service to initialize |
| session | the service's owning session |
| service_type | the service ID number |
References mwService_init().
Referenced by mwService_init().
| void mwService_recv | ( | struct mwService * | service, |
| struct mwChannel * | channel, | ||
| guint16 | msg_type, | ||
| struct mwOpaque * | data ) |
Triggers the input handler on the service.
| service | the service to receive the input |
| channel | the channel the input was received from |
| msg_type | the service-dependant message type |
| data | the message data |
References mwService_recv().
Referenced by mwService_recv().
| void mwService_recvAccept | ( | struct mwService * | service, |
| struct mwChannel * | channel, | ||
| struct mwMsgChannelAccept * | msg ) |
Triggers the recv_accept handler on the service.
| service | the service to handle the message |
| channel | the channel being accepted |
| msg | the channel accept message |
References mwService_recvAccept().
Referenced by mwService_recvAccept().
| void mwService_recvCreate | ( | struct mwService * | service, |
| struct mwChannel * | channel, | ||
| struct mwMsgChannelCreate * | msg ) |
Triggers the recv_create handler on the service.
| service | the service to handle the message |
| channel | the channel being created |
| msg | the channel create message |
References mwService_recvCreate().
Referenced by mwService_recvCreate().
| void mwService_recvDestroy | ( | struct mwService * | service, |
| struct mwChannel * | channel, | ||
| struct mwMsgChannelDestroy * | msg ) |
Triggers the recv_destroy handler on the service.
| service | the service to handle the message |
| channel | the channel being destroyed |
| msg | the channel destroy message |
References mwService_recvDestroy().
Referenced by mwService_recvDestroy().
| void mwService_removeClientData | ( | struct mwService * | service | ) |
Removes client data from service.
If there is a cleanup function, it will be called.
References mwService_removeClientData().
Referenced by mwService_removeClientData().
| void mwService_setClientData | ( | struct mwService * | service, |
| gpointer | data, | ||
| GDestroyNotify | cleanup ) |
Associates client data with service.
If there is existing data, it will not have its cleanup function called. Client data is not for use by service implementations. Rather, it is for use by client code which may later make use of those service implementations.
References mwService_setClientData().
Referenced by mwService_setClientData().
| void mwService_start | ( | struct mwService * | service | ) |
Triggers the start handler for the service.
Normally called from the session upon receipt of a service available message. Service implementations should use this handler to open any necessary channels, etc. Checks that the service is STOPPED, or returns.
| service | The service to start |
References mwService_start().
Referenced by mwService_start().
| void mwService_started | ( | struct mwService * | service | ) |
Indicate that a service is started.
To be used by service implementations when the service is fully started.
References mwService_started().
Referenced by mwService_started().
| void mwService_stop | ( | struct mwService * | service | ) |
Triggers the stop handler for the service.
Normally called from the session before closing down the connection. Checks that the service is STARTED or STARTING, or returns
| service | The service to stop |
References mwService_stop().
Referenced by mwService_stop().
| void mwService_stopped | ( | struct mwService * | service | ) |
Indicate that a service is stopped.
To be used by service implementations when the service is fully stopped.
References mwService_stopped().
Referenced by mwService_stopped().