\hypertarget{mw__service_8h}{
\section{mw\_\-service.h File Reference}
\label{mw__service_8h}\index{mw\_\-service.h@{mw\_\-service.h}}
}


{\tt \#include \char`\"{}mw\_\-common.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structmwService}{mwService}
\begin{CompactList}\small\item\em A service is the recipient of sendOnCnl messages sent over channels marked with the corresponding service id. \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{mw__service_8h_c47dd34aa0115ff9f5df0ca802eddca6}{MW\_\-SERVICE}(srv)~((struct \hyperlink{structmwService}{mwService} $\ast$) srv)
\begin{CompactList}\small\item\em Casts a concrete service (such as \hyperlink{structmwServiceAware}{mwServiceAware}) into a \hyperlink{structmwService}{mwService}. \item\end{CompactList}\item 
\#define \hyperlink{mw__service_8h_cb3501a93a34855c8c5a5f712470ddd7}{MW\_\-SERVICE\_\-IS\_\-DEAD}(srvc)~(MW\_\-SERVICE\_\-IS\_\-STOPPING(srvc) $|$$|$ MW\_\-SERVICE\_\-IS\_\-STOPPED(srvc))
\begin{CompactList}\small\item\em If a service is STOPPING or STOPPED, it's considered DEAD. \item\end{CompactList}\item 
\#define \hyperlink{mw__service_8h_a9214389e880b032dd2ba4d68628b010}{MW\_\-SERVICE\_\-IS\_\-LIVE}(srvc)~(MW\_\-SERVICE\_\-IS\_\-STARTING(srvc) $|$$|$ MW\_\-SERVICE\_\-IS\_\-STARTED(srvc))
\begin{CompactList}\small\item\em If a service is STARTING or STARTED, it's considered LIVE. \item\end{CompactList}\item 
\#define \hyperlink{mw__service_8h_6a5393b8935f62a87a2e5767da74ddc0}{MW\_\-SERVICE\_\-IS\_\-STARTED}(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STARTED)
\item 
\#define \hyperlink{mw__service_8h_c8f916221c8b1ec24c31896f3c76430e}{MW\_\-SERVICE\_\-IS\_\-STARTING}(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STARTING)
\item 
\#define \hyperlink{mw__service_8h_6a5c28fe3e3b26f9b101ebcb1c8cb8ff}{MW\_\-SERVICE\_\-IS\_\-STATE}(srvc, \hyperlink{structmwService_b5adc0f5a0cbeddaece7a4512ec66099}{state})~(mwService\_\-getState(MW\_\-SERVICE(srvc)) == (\hyperlink{structmwService_b5adc0f5a0cbeddaece7a4512ec66099}{state}))
\item 
\#define \hyperlink{mw__service_8h_cfcb034d38d2c35d499c786c311af3ab}{MW\_\-SERVICE\_\-IS\_\-STOPPED}(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STOPPED)
\item 
\#define \hyperlink{mw__service_8h_4e064cb059d437e86f72eeff055a5170}{MW\_\-SERVICE\_\-IS\_\-STOPPING}(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STOPPING)
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_a61b5086d147a38f2dfd6c136916f232}{mwService\_\-funcClear} )(struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
typedef const char $\ast$($\ast$ \hyperlink{mw__service_8h_cdf3ce1a852e3cc3cf1379e083ff8ffd}{mwService\_\-funcGetDesc} )(struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
typedef const char $\ast$($\ast$ \hyperlink{mw__service_8h_f4becc5dcb225e192b6c92d8a72a432c}{mwService\_\-funcGetName} )(struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_71e4e8071893d3588d3c8f5f3be660b4}{mwService\_\-funcRecv} )(struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, guint16 msg\_\-type, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_7bf9bcb70ba1944f027140328edcb145}{mwService\_\-funcRecvAccept} )(struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelAccept}{mwMsgChannelAccept} $\ast$msg)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_39b4834a00b1e19d98432fbfe9653ab8}{mwService\_\-funcRecvCreate} )(struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelCreate}{mwMsgChannelCreate} $\ast$msg)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_4741b85ca24938110fb9d13d6682c497}{mwService\_\-funcRecvDestroy} )(struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelDestroy}{mwMsgChannelDestroy} $\ast$msg)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_345848a5ac34f9fbe69a5dfea7fbc4b9}{mwService\_\-funcStart} )(struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
typedef void($\ast$ \hyperlink{mw__service_8h_1179c7de60ece58e88a69e204d0de59e}{mwService\_\-funcStop} )(struct \hyperlink{structmwService}{mwService} $\ast$service)
\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9}{mwServiceState} \{ \par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a93e645546696ee1e12383795826d8f2c2}{mwServiceState\_\-STOPPED}, 
\par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a91381383b88d69d1b4b147999f7d2e9e4}{mwServiceState\_\-STOPPING}, 
\par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9c1d80a3975accbe424d43855eae9ba96}{mwServiceState\_\-STARTED}, 
\par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a95d370240ae109e408d7a79dab0006765}{mwServiceState\_\-STARTING}, 
\par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a96dd6d02356710ebc0ad952e634bf69db}{mwServiceState\_\-ERROR}, 
\par
\hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9cd926c48397703e396b556448c23ce12}{mwServiceState\_\-UNKNOWN}
 \}
\begin{CompactList}\small\item\em State-tracking for a service. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{Indent}{\bf General Services API}\par
{\em These functions provide unified access to the general functions of a client service, with some simple sanity-checking.}\begin{CompactItemize}
\item 
void \hyperlink{mw__service_8h_c8adb7938b9884ad32e4700a4d933668}{mwService\_\-free} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Frees memory used by a service. \item\end{CompactList}\item 
gpointer \hyperlink{mw__service_8h_94ab61559c154ad55b5038830b77d9bd}{mwService\_\-getClientData} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Reference associated client data. \item\end{CompactList}\item 
const char $\ast$ \hyperlink{mw__service_8h_2498e7ac091f10521ccaa39cbe78348f}{mwService\_\-getDesc} (struct \hyperlink{structmwService}{mwService} $\ast$)
\item 
const char $\ast$ \hyperlink{mw__service_8h_193520bf842ab5aa1ea7e9542a93b832}{mwService\_\-getName} (struct \hyperlink{structmwService}{mwService} $\ast$)
\item 
struct \hyperlink{structmwSession}{mwSession} $\ast$ \hyperlink{mw__service_8h_dd5b48a3309dc9c356c4537baa37535e}{mwService\_\-getSession} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
enum \hyperlink{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9}{mwServiceState} \hyperlink{mw__service_8h_80be3d5c087a5c5bfdf23174e00d1af0}{mwService\_\-getState} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\item 
guint32 \hyperlink{mw__service_8h_86b61f33fc9a9484c8f7c3177deeb004}{mwService\_\-getType} (struct \hyperlink{structmwService}{mwService} $\ast$)
\item 
void \hyperlink{mw__service_8h_dae02fc3d770260deed3e04387145e44}{mwService\_\-recv} (struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, guint16 msg\_\-type, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\begin{CompactList}\small\item\em Triggers the input handler on the service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_d07b444814007f616441021b02b29e0b}{mwService\_\-recvAccept} (struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelAccept}{mwMsgChannelAccept} $\ast$msg)
\begin{CompactList}\small\item\em Triggers the recv\_\-accept handler on the service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_826ac106b94fc7d4dd8b7efcc70d5355}{mwService\_\-recvCreate} (struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelCreate}{mwMsgChannelCreate} $\ast$msg)
\begin{CompactList}\small\item\em Triggers the recv\_\-create handler on the service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_af155b961ad4fbf55cb8b593ec29dc60}{mwService\_\-recvDestroy} (struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel, struct \hyperlink{structmwMsgChannelDestroy}{mwMsgChannelDestroy} $\ast$msg)
\begin{CompactList}\small\item\em Triggers the recv\_\-destroy handler on the service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_115153000304eccc772c0313da5dd5dd}{mwService\_\-removeClientData} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Removes client data from service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_7c3e0cdcb6631cb0da3b79572fdc5c95}{mwService\_\-setClientData} (struct \hyperlink{structmwService}{mwService} $\ast$service, gpointer data, GDestroyNotify cleanup)
\begin{CompactList}\small\item\em Associates client data with service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_177f564b1ed8f8544ab5089d7e4afbb0}{mwService\_\-start} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Triggers the start handler for the service. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_f591d13a2ef57d42b63947dcae6faa5f}{mwService\_\-stop} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Triggers the stop handler for the service. \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Service Extension API}\par
{\em These functions are for use by service implementations }\begin{CompactItemize}
\item 
void \hyperlink{mw__service_8h_977c751125e97fb60dc212c57f03ed6e}{mwService\_\-init} (struct \hyperlink{structmwService}{mwService} $\ast$service, struct \hyperlink{structmwSession}{mwSession} $\ast$\hyperlink{structmwService_0c2badd2256155b2bee149fa4b57b7d6}{session}, guint32 service\_\-type)
\begin{CompactList}\small\item\em Prepares a newly allocated service for use. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_fbb26101bfdd8ab4df279dd907a2510a}{mwService\_\-started} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Indicate that a service is started. \item\end{CompactList}\item 
void \hyperlink{mw__service_8h_b361f3df95b1611961ab0ec4ac69eddf}{mwService\_\-stopped} (struct \hyperlink{structmwService}{mwService} $\ast$service)
\begin{CompactList}\small\item\em Indicate that a service is stopped. \item\end{CompactList}\end{CompactItemize}
\end{Indent}


\subsection{Define Documentation}
\hypertarget{mw__service_8h_c47dd34aa0115ff9f5df0ca802eddca6}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE@{MW\_\-SERVICE}}
\index{MW\_\-SERVICE@{MW\_\-SERVICE}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE(srv)~((struct {\bf mwService} $\ast$) srv)}}
\label{mw__service_8h_c47dd34aa0115ff9f5df0ca802eddca6}


Casts a concrete service (such as \hyperlink{structmwServiceAware}{mwServiceAware}) into a \hyperlink{structmwService}{mwService}. 

\hypertarget{mw__service_8h_cb3501a93a34855c8c5a5f712470ddd7}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-DEAD@{MW\_\-SERVICE\_\-IS\_\-DEAD}}
\index{MW\_\-SERVICE\_\-IS\_\-DEAD@{MW\_\-SERVICE\_\-IS\_\-DEAD}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-DEAD(srvc)~(MW\_\-SERVICE\_\-IS\_\-STOPPING(srvc) $|$$|$ MW\_\-SERVICE\_\-IS\_\-STOPPED(srvc))}}
\label{mw__service_8h_cb3501a93a34855c8c5a5f712470ddd7}


If a service is STOPPING or STOPPED, it's considered DEAD. 

\hypertarget{mw__service_8h_a9214389e880b032dd2ba4d68628b010}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-LIVE@{MW\_\-SERVICE\_\-IS\_\-LIVE}}
\index{MW\_\-SERVICE\_\-IS\_\-LIVE@{MW\_\-SERVICE\_\-IS\_\-LIVE}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-LIVE(srvc)~(MW\_\-SERVICE\_\-IS\_\-STARTING(srvc) $|$$|$ MW\_\-SERVICE\_\-IS\_\-STARTED(srvc))}}
\label{mw__service_8h_a9214389e880b032dd2ba4d68628b010}


If a service is STARTING or STARTED, it's considered LIVE. 

\hypertarget{mw__service_8h_6a5393b8935f62a87a2e5767da74ddc0}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-STARTED@{MW\_\-SERVICE\_\-IS\_\-STARTED}}
\index{MW\_\-SERVICE\_\-IS\_\-STARTED@{MW\_\-SERVICE\_\-IS\_\-STARTED}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-STARTED(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STARTED)}}
\label{mw__service_8h_6a5393b8935f62a87a2e5767da74ddc0}


\hypertarget{mw__service_8h_c8f916221c8b1ec24c31896f3c76430e}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-STARTING@{MW\_\-SERVICE\_\-IS\_\-STARTING}}
\index{MW\_\-SERVICE\_\-IS\_\-STARTING@{MW\_\-SERVICE\_\-IS\_\-STARTING}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-STARTING(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STARTING)}}
\label{mw__service_8h_c8f916221c8b1ec24c31896f3c76430e}


\hypertarget{mw__service_8h_6a5c28fe3e3b26f9b101ebcb1c8cb8ff}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-STATE@{MW\_\-SERVICE\_\-IS\_\-STATE}}
\index{MW\_\-SERVICE\_\-IS\_\-STATE@{MW\_\-SERVICE\_\-IS\_\-STATE}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-STATE(srvc, \/  {\bf state})~(mwService\_\-getState(MW\_\-SERVICE(srvc)) == ({\bf state}))}}
\label{mw__service_8h_6a5c28fe3e3b26f9b101ebcb1c8cb8ff}


\hypertarget{mw__service_8h_cfcb034d38d2c35d499c786c311af3ab}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-STOPPED@{MW\_\-SERVICE\_\-IS\_\-STOPPED}}
\index{MW\_\-SERVICE\_\-IS\_\-STOPPED@{MW\_\-SERVICE\_\-IS\_\-STOPPED}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-STOPPED(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STOPPED)}}
\label{mw__service_8h_cfcb034d38d2c35d499c786c311af3ab}


\hypertarget{mw__service_8h_4e064cb059d437e86f72eeff055a5170}{
\index{mw\_\-service.h@{mw\_\-service.h}!MW\_\-SERVICE\_\-IS\_\-STOPPING@{MW\_\-SERVICE\_\-IS\_\-STOPPING}}
\index{MW\_\-SERVICE\_\-IS\_\-STOPPING@{MW\_\-SERVICE\_\-IS\_\-STOPPING}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-SERVICE\_\-IS\_\-STOPPING(srvc)~MW\_\-SERVICE\_\-IS\_\-STATE(srvc, mwServiceState\_\-STOPPING)}}
\label{mw__service_8h_4e064cb059d437e86f72eeff055a5170}




\subsection{Typedef Documentation}
\hypertarget{mw__service_8h_a61b5086d147a38f2dfd6c136916f232}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcClear@{mwService\_\-funcClear}}
\index{mwService\_\-funcClear@{mwService\_\-funcClear}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcClear})(struct {\bf mwService} $\ast$service)}}
\label{mw__service_8h_a61b5086d147a38f2dfd6c136916f232}


\hypertarget{mw__service_8h_cdf3ce1a852e3cc3cf1379e083ff8ffd}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcGetDesc@{mwService\_\-funcGetDesc}}
\index{mwService\_\-funcGetDesc@{mwService\_\-funcGetDesc}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef const char$\ast$($\ast$ {\bf mwService\_\-funcGetDesc})(struct {\bf mwService} $\ast$service)}}
\label{mw__service_8h_cdf3ce1a852e3cc3cf1379e083ff8ffd}


\hypertarget{mw__service_8h_f4becc5dcb225e192b6c92d8a72a432c}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcGetName@{mwService\_\-funcGetName}}
\index{mwService\_\-funcGetName@{mwService\_\-funcGetName}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef const char$\ast$($\ast$ {\bf mwService\_\-funcGetName})(struct {\bf mwService} $\ast$service)}}
\label{mw__service_8h_f4becc5dcb225e192b6c92d8a72a432c}


\hypertarget{mw__service_8h_71e4e8071893d3588d3c8f5f3be660b4}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcRecv@{mwService\_\-funcRecv}}
\index{mwService\_\-funcRecv@{mwService\_\-funcRecv}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcRecv})(struct {\bf mwService} $\ast$service, struct {\bf mwChannel} $\ast$channel, guint16 msg\_\-type, struct {\bf mwOpaque} $\ast$data)}}
\label{mw__service_8h_71e4e8071893d3588d3c8f5f3be660b4}


\hypertarget{mw__service_8h_7bf9bcb70ba1944f027140328edcb145}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcRecvAccept@{mwService\_\-funcRecvAccept}}
\index{mwService\_\-funcRecvAccept@{mwService\_\-funcRecvAccept}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcRecvAccept})(struct {\bf mwService} $\ast$service, struct {\bf mwChannel} $\ast$channel, struct {\bf mwMsgChannelAccept} $\ast$msg)}}
\label{mw__service_8h_7bf9bcb70ba1944f027140328edcb145}


\begin{Desc}
\item[\hyperlink{todo__todo000003}{Todo}]remove msg and replace with appropriate additional parameters \end{Desc}
\hypertarget{mw__service_8h_39b4834a00b1e19d98432fbfe9653ab8}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcRecvCreate@{mwService\_\-funcRecvCreate}}
\index{mwService\_\-funcRecvCreate@{mwService\_\-funcRecvCreate}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcRecvCreate})(struct {\bf mwService} $\ast$service, struct {\bf mwChannel} $\ast$channel, struct {\bf mwMsgChannelCreate} $\ast$msg)}}
\label{mw__service_8h_39b4834a00b1e19d98432fbfe9653ab8}


\begin{Desc}
\item[\hyperlink{todo__todo000002}{Todo}]remove msg and replace with appropriate additional parameters \end{Desc}
\hypertarget{mw__service_8h_4741b85ca24938110fb9d13d6682c497}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcRecvDestroy@{mwService\_\-funcRecvDestroy}}
\index{mwService\_\-funcRecvDestroy@{mwService\_\-funcRecvDestroy}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcRecvDestroy})(struct {\bf mwService} $\ast$service, struct {\bf mwChannel} $\ast$channel, struct {\bf mwMsgChannelDestroy} $\ast$msg)}}
\label{mw__service_8h_4741b85ca24938110fb9d13d6682c497}


\begin{Desc}
\item[\hyperlink{todo__todo000004}{Todo}]remove msg and replace with appropriate additional parameters \end{Desc}
\hypertarget{mw__service_8h_345848a5ac34f9fbe69a5dfea7fbc4b9}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcStart@{mwService\_\-funcStart}}
\index{mwService\_\-funcStart@{mwService\_\-funcStart}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcStart})(struct {\bf mwService} $\ast$service)}}
\label{mw__service_8h_345848a5ac34f9fbe69a5dfea7fbc4b9}


\hypertarget{mw__service_8h_1179c7de60ece58e88a69e204d0de59e}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-funcStop@{mwService\_\-funcStop}}
\index{mwService\_\-funcStop@{mwService\_\-funcStop}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ {\bf mwService\_\-funcStop})(struct {\bf mwService} $\ast$service)}}
\label{mw__service_8h_1179c7de60ece58e88a69e204d0de59e}




\subsection{Enumeration Type Documentation}
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState@{mwServiceState}}
\index{mwServiceState@{mwServiceState}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwServiceState}}}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9}


State-tracking for a service. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{mwServiceState\_\-STOPPED@{mwServiceState\_\-STOPPED}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-STOPPED@{mwServiceState\_\-STOPPED}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a93e645546696ee1e12383795826d8f2c2}{
mwServiceState\_\-STOPPED}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a93e645546696ee1e12383795826d8f2c2}
}]the service is not active \index{mwServiceState\_\-STOPPING@{mwServiceState\_\-STOPPING}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-STOPPING@{mwServiceState\_\-STOPPING}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a91381383b88d69d1b4b147999f7d2e9e4}{
mwServiceState\_\-STOPPING}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a91381383b88d69d1b4b147999f7d2e9e4}
}]the service is shutting down \index{mwServiceState\_\-STARTED@{mwServiceState\_\-STARTED}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-STARTED@{mwServiceState\_\-STARTED}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9c1d80a3975accbe424d43855eae9ba96}{
mwServiceState\_\-STARTED}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9c1d80a3975accbe424d43855eae9ba96}
}]the service is active \index{mwServiceState\_\-STARTING@{mwServiceState\_\-STARTING}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-STARTING@{mwServiceState\_\-STARTING}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a95d370240ae109e408d7a79dab0006765}{
mwServiceState\_\-STARTING}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a95d370240ae109e408d7a79dab0006765}
}]the service is starting up \index{mwServiceState\_\-ERROR@{mwServiceState\_\-ERROR}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-ERROR@{mwServiceState\_\-ERROR}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a96dd6d02356710ebc0ad952e634bf69db}{
mwServiceState\_\-ERROR}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a96dd6d02356710ebc0ad952e634bf69db}
}]error in service, shutting down \index{mwServiceState\_\-UNKNOWN@{mwServiceState\_\-UNKNOWN}!mw\_\-service.h@{mw\_\-service.h}}\index{mw\_\-service.h@{mw\_\-service.h}!mwServiceState\_\-UNKNOWN@{mwServiceState\_\-UNKNOWN}}\item[{\em 
\hypertarget{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9cd926c48397703e396b556448c23ce12}{
mwServiceState\_\-UNKNOWN}
\label{mw__service_8h_7ce6ac62b951a443c05f541c8ace90a9cd926c48397703e396b556448c23ce12}
}]error determining state \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{mw__service_8h_c8adb7938b9884ad32e4700a4d933668}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-free@{mwService\_\-free}}
\index{mwService\_\-free@{mwService\_\-free}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-free (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_c8adb7938b9884ad32e4700a4d933668}


Frees memory used by a service. 

Will trigger the stop handler if the service is STARTED or STARTING. Triggers clear handler to allow cleanup.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]The service to clear and free \end{description}
\end{Desc}
\hypertarget{mw__service_8h_94ab61559c154ad55b5038830b77d9bd}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getClientData@{mwService\_\-getClientData}}
\index{mwService\_\-getClientData@{mwService\_\-getClientData}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gpointer mwService\_\-getClientData (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_94ab61559c154ad55b5038830b77d9bd}


Reference associated client data. 

\hypertarget{mw__service_8h_2498e7ac091f10521ccaa39cbe78348f}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getDesc@{mwService\_\-getDesc}}
\index{mwService\_\-getDesc@{mwService\_\-getDesc}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mwService\_\-getDesc (struct {\bf mwService} $\ast$)}}
\label{mw__service_8h_2498e7ac091f10521ccaa39cbe78348f}


\begin{Desc}
\item[Returns:]string short description of the service \end{Desc}
\hypertarget{mw__service_8h_193520bf842ab5aa1ea7e9542a93b832}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getName@{mwService\_\-getName}}
\index{mwService\_\-getName@{mwService\_\-getName}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mwService\_\-getName (struct {\bf mwService} $\ast$)}}
\label{mw__service_8h_193520bf842ab5aa1ea7e9542a93b832}


\begin{Desc}
\item[Returns:]string short name of the service \end{Desc}
\hypertarget{mw__service_8h_dd5b48a3309dc9c356c4537baa37535e}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getSession@{mwService\_\-getSession}}
\index{mwService\_\-getSession@{mwService\_\-getSession}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwSession}$\ast$ mwService\_\-getSession (struct {\bf mwService} $\ast$ {\em service})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__service_8h_dd5b48a3309dc9c356c4537baa37535e}


\begin{Desc}
\item[Returns:]the service's session \end{Desc}
\hypertarget{mw__service_8h_80be3d5c087a5c5bfdf23174e00d1af0}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getState@{mwService\_\-getState}}
\index{mwService\_\-getState@{mwService\_\-getState}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwServiceState} mwService\_\-getState (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_80be3d5c087a5c5bfdf23174e00d1af0}


\begin{Desc}
\item[Returns:]the service's state \end{Desc}
\hypertarget{mw__service_8h_86b61f33fc9a9484c8f7c3177deeb004}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-getType@{mwService\_\-getType}}
\index{mwService\_\-getType@{mwService\_\-getType}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwService\_\-getType (struct {\bf mwService} $\ast$)}}
\label{mw__service_8h_86b61f33fc9a9484c8f7c3177deeb004}


\begin{Desc}
\item[Returns:]the appropriate type id for the service \end{Desc}
\hypertarget{mw__service_8h_977c751125e97fb60dc212c57f03ed6e}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-init@{mwService\_\-init}}
\index{mwService\_\-init@{mwService\_\-init}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-init (struct {\bf mwService} $\ast$ {\em service}, \/  struct {\bf mwSession} $\ast$ {\em session}, \/  guint32 {\em service\_\-type})}}
\label{mw__service_8h_977c751125e97fb60dc212c57f03ed6e}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the service to initialize \item[{\em session}]the service's owning session \item[{\em service\_\-type}]the service ID number \end{description}
\end{Desc}
\hypertarget{mw__service_8h_dae02fc3d770260deed3e04387145e44}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-recv@{mwService\_\-recv}}
\index{mwService\_\-recv@{mwService\_\-recv}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-recv (struct {\bf mwService} $\ast$ {\em service}, \/  struct {\bf mwChannel} $\ast$ {\em channel}, \/  guint16 {\em msg\_\-type}, \/  struct {\bf mwOpaque} $\ast$ {\em data})}}
\label{mw__service_8h_dae02fc3d770260deed3e04387145e44}


Triggers the input handler on the service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the service to receive the input \item[{\em channel}]the channel the input was received from \item[{\em msg\_\-type}]the service-dependant message type \item[{\em data}]the message data \end{description}
\end{Desc}
\hypertarget{mw__service_8h_d07b444814007f616441021b02b29e0b}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-recvAccept@{mwService\_\-recvAccept}}
\index{mwService\_\-recvAccept@{mwService\_\-recvAccept}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-recvAccept (struct {\bf mwService} $\ast$ {\em service}, \/  struct {\bf mwChannel} $\ast$ {\em channel}, \/  struct {\bf mwMsgChannelAccept} $\ast$ {\em msg})}}
\label{mw__service_8h_d07b444814007f616441021b02b29e0b}


Triggers the recv\_\-accept handler on the service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the service to handle the message \item[{\em channel}]the channel being accepted \item[{\em msg}]the channel accept message \end{description}
\end{Desc}
\hypertarget{mw__service_8h_826ac106b94fc7d4dd8b7efcc70d5355}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-recvCreate@{mwService\_\-recvCreate}}
\index{mwService\_\-recvCreate@{mwService\_\-recvCreate}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-recvCreate (struct {\bf mwService} $\ast$ {\em service}, \/  struct {\bf mwChannel} $\ast$ {\em channel}, \/  struct {\bf mwMsgChannelCreate} $\ast$ {\em msg})}}
\label{mw__service_8h_826ac106b94fc7d4dd8b7efcc70d5355}


Triggers the recv\_\-create handler on the service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the service to handle the message \item[{\em channel}]the channel being created \item[{\em msg}]the channel create message \end{description}
\end{Desc}
\hypertarget{mw__service_8h_af155b961ad4fbf55cb8b593ec29dc60}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-recvDestroy@{mwService\_\-recvDestroy}}
\index{mwService\_\-recvDestroy@{mwService\_\-recvDestroy}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-recvDestroy (struct {\bf mwService} $\ast$ {\em service}, \/  struct {\bf mwChannel} $\ast$ {\em channel}, \/  struct {\bf mwMsgChannelDestroy} $\ast$ {\em msg})}}
\label{mw__service_8h_af155b961ad4fbf55cb8b593ec29dc60}


Triggers the recv\_\-destroy handler on the service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the service to handle the message \item[{\em channel}]the channel being destroyed \item[{\em msg}]the channel destroy message \end{description}
\end{Desc}
\hypertarget{mw__service_8h_115153000304eccc772c0313da5dd5dd}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-removeClientData@{mwService\_\-removeClientData}}
\index{mwService\_\-removeClientData@{mwService\_\-removeClientData}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-removeClientData (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_115153000304eccc772c0313da5dd5dd}


Removes client data from service. 

If there is a cleanup function, it will be called. \hypertarget{mw__service_8h_7c3e0cdcb6631cb0da3b79572fdc5c95}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-setClientData@{mwService\_\-setClientData}}
\index{mwService\_\-setClientData@{mwService\_\-setClientData}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-setClientData (struct {\bf mwService} $\ast$ {\em service}, \/  gpointer {\em data}, \/  GDestroyNotify {\em cleanup})}}
\label{mw__service_8h_7c3e0cdcb6631cb0da3b79572fdc5c95}


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. \hypertarget{mw__service_8h_177f564b1ed8f8544ab5089d7e4afbb0}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-start@{mwService\_\-start}}
\index{mwService\_\-start@{mwService\_\-start}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-start (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_177f564b1ed8f8544ab5089d7e4afbb0}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]The service to start \end{description}
\end{Desc}
\hypertarget{mw__service_8h_fbb26101bfdd8ab4df279dd907a2510a}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-started@{mwService\_\-started}}
\index{mwService\_\-started@{mwService\_\-started}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-started (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_fbb26101bfdd8ab4df279dd907a2510a}


Indicate that a service is started. 

To be used by service implementations when the service is fully started. \hypertarget{mw__service_8h_f591d13a2ef57d42b63947dcae6faa5f}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-stop@{mwService\_\-stop}}
\index{mwService\_\-stop@{mwService\_\-stop}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-stop (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_f591d13a2ef57d42b63947dcae6faa5f}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]The service to stop \end{description}
\end{Desc}
\hypertarget{mw__service_8h_b361f3df95b1611961ab0ec4ac69eddf}{
\index{mw\_\-service.h@{mw\_\-service.h}!mwService\_\-stopped@{mwService\_\-stopped}}
\index{mwService\_\-stopped@{mwService\_\-stopped}!mw_service.h@{mw\_\-service.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwService\_\-stopped (struct {\bf mwService} $\ast$ {\em service})}}
\label{mw__service_8h_b361f3df95b1611961ab0ec4ac69eddf}


Indicate that a service is stopped. 

To be used by service implementations when the service is fully stopped. 