\hypertarget{mw__channel_8h}{
\section{mw\_\-channel.h File Reference}
\label{mw__channel_8h}\index{mw\_\-channel.h@{mw\_\-channel.h}}
}


\subsection{Detailed Description}
Life-cycle of an outgoing channel:. 

1: mwChannel\_\-new is called. If there is a channel in the outgoing collection in state NEW, then it is returned. Otherwise, a channel is allocated, assigned a unique outgoing id, marked as NEW, and returned.

2: channel is set to INIT status (effectively earmarking it as in- use). fields on the channel can then be set as necessary to prepare it for creation.

3: mwChannel\_\-create is called. The channel is marked to WAIT status and a message is sent to the server. The channel is also marked as inactive as of that moment.

4: the channel is accepted (step 5) or rejected (step 7)

5: an accept message is received from the server, and the channel is marked as OPEN, and the inactive mark is removed. And messages in the in or out queues for that channel are processed. The channel is now ready to be used.

6: data is sent and received over the channel

7: the channel is closed either by receipt of a close message or by local action. If by local action, then a close message is sent to the server. The channel is cleaned up, its queues dumped, and it is set to NEW status to await re-use.

Life-cycle of an incoming channel:

1: a channel create message is received. A channel is allocated and given an id matching the message. It is placed in status WAIT, and marked as inactive as of that moment. The service matching that channel is alerted of the incoming creation request.

2: the service can either accept (step 3) or reject (step 5) the channel

3: mwChannel\_\-accept is called. The channel is marked as OPEN, and an accept message is sent to the server. And messages in the in or out queues for that channel are processed. The channel is now ready to be used.

4: data is sent and received over the channel

5: The channel is closed either by receipt of a close message or by local action. If by local action, then a close message is sent to the server. The channel is cleaned up, its queues dumped, and it is deallocated. 

{\tt \#include $<$time.h$>$}\par
{\tt \#include \char`\"{}mw\_\-common.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{mw__channel_8h_1a2154c83a846c017653a2ee8c1aaa35}{MW\_\-MASTER\_\-CHANNEL\_\-ID}~0x00000000
\begin{CompactList}\small\item\em special ID indicating the master channel \item\end{CompactList}\item 
\#define \hyperlink{mw__channel_8h_74bd8e3a8a90d421b1a9a7e4b7acec89}{mwChannel\_\-idIsIncoming}(id)~(! mwChannel\_\-idIsOutgoing(id))
\begin{CompactList}\small\item\em non-zero if a channel id appears to be that of an incoming channel \item\end{CompactList}\item 
\#define \hyperlink{mw__channel_8h_1c4fa767a8f09e32aaa8b180c1b836f5}{mwChannel\_\-idIsOutgoing}(id)~(! (0x80000000 \& (id)))
\begin{CompactList}\small\item\em non-zero if a channel id appears to be that of an outgoing channel \item\end{CompactList}\item 
\#define \hyperlink{mw__channel_8h_ea68737cfe6d90e09b13ba1b95b9c633}{mwChannel\_\-isIncoming}(chan)~mwChannel\_\-idIsIncoming(mwChannel\_\-getId(chan))
\begin{CompactList}\small\item\em non-zero if a channel appears to be an incoming channel \item\end{CompactList}\item 
\#define \hyperlink{mw__channel_8h_f8dd8d1088786774775243383f8f8f28}{mwChannel\_\-isOutgoing}(chan)~mwChannel\_\-idIsOutgoing(mwChannel\_\-getId(chan))
\begin{CompactList}\small\item\em non-zero if a channel appears to be an outgoing channel \item\end{CompactList}\item 
\#define \hyperlink{mw__channel_8h_cb79280fcff820ba79c7f2a9b9dbe0e0}{mwChannel\_\-isState}(chan, \hyperlink{structmwService_b5adc0f5a0cbeddaece7a4512ec66099}{state})~(mwChannel\_\-getState(chan) == (\hyperlink{structmwService_b5adc0f5a0cbeddaece7a4512ec66099}{state}))
\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11}{mwChannelState} \{ \par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd110015e6ab100dcc9072046d4fbccf1c5c}{mwChannel\_\-NEW}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1181856c37ab30b5c5dc918230e74b41be}{mwChannel\_\-INIT}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11cc17dbc14dcca5f07db0e1086b1787d7}{mwChannel\_\-WAIT}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd119b079efae54c7ce19a75cc72bb4bdf1d}{mwChannel\_\-OPEN}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd114dbdbd31d9ff0fb6b973a665ab28a640}{mwChannel\_\-DESTROY}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1113307644c3c44174b3374e165e4bd609}{mwChannel\_\-ERROR}, 
\par
\hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11037260bf612b5b449b9dfc25f14d863c}{mwChannel\_\-UNKNOWN}
 \}
\begin{CompactList}\small\item\em channel status \item\end{CompactList}\item 
enum \hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e}{mwChannelStatField} \{ \par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e2fb930374933a4ae3bcbb59c38100453}{mwChannelStat\_\-MSG\_\-SENT}, 
\par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e0b9cd0c35eae32dde00d1757863c0c72}{mwChannelStat\_\-MSG\_\-RECV}, 
\par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5cb8465381680632b7f9f12c35e36b36}{mwChannelStat\_\-U\_\-BYTES\_\-SENT}, 
\par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e76fcf9b81600e77219e91476087127ca}{mwChannelStat\_\-U\_\-BYTES\_\-RECV}, 
\par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e89b26adcb1a6ecb4cf7f871856c597ce}{mwChannelStat\_\-OPENED\_\-AT}, 
\par
\hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5eef1f4cfa0960802e63d5c98c1fc987}{mwChannelStat\_\-CLOSED\_\-AT}
 \}
\begin{CompactList}\small\item\em channel statistic fields. \item\end{CompactList}\item 
enum \hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd}{mwEncryptPolicy} \{ \par
\hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd8fb49fce96dafa93f4574079bcefefcd}{mwEncrypt\_\-NONE} =  0x0000, 
\par
\hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd23970e8fbf808d49e753b76edd2f7dac}{mwEncrypt\_\-WHATEVER} =  0x0001, 
\par
\hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd751e7884abd7fff5bf60df3be83acb49}{mwEncrypt\_\-ALL} =  0x0002, 
\par
\hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778ddb501a631c7ce9cf2afb4c3ae80a5f228}{mwEncrypt\_\-RC2\_\-40} =  0x1000, 
\par
\hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd24d43c164f072dfdb19b9b3b739b5e2c}{mwEncrypt\_\-RC2\_\-128} =  0x2000
 \}
\begin{CompactList}\small\item\em Policy for a channel, dictating what sort of encryption should be used, if any, and when. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{mw__channel_8h_8c72269dfed1ad1a32a2f44501c3961a}{mwChannel\_\-accept} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em Formally accept an incoming channel. \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_7c85be3b885f7bb2119707e78c9f1c1d}{mwChannel\_\-addSupportedCipherInstance} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em add a cipher instance to a channel's list of supported ciphers. \item\end{CompactList}\item 
int \hyperlink{mw__channel_8h_c0b5dba71d6c2ac2780b094bae9bda13}{mwChannel\_\-create} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em Formally open a channel. \item\end{CompactList}\item 
int \hyperlink{mw__channel_8h_cbfd68a6393902b1e396c19086cb8703}{mwChannel\_\-destroy} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 reason, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\begin{CompactList}\small\item\em Destroy a channel. \item\end{CompactList}\item 
struct \hyperlink{structmwChannel}{mwChannel} $\ast$ \hyperlink{mw__channel_8h_dbaba2dd85c52344f8ff813673945664}{mwChannel\_\-find} (struct \hyperlink{structmwChannelSet}{mwChannelSet} $\ast$cs, guint32 chan)
\begin{CompactList}\small\item\em Obtain a reference to a channel by its id. \item\end{CompactList}\item 
struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$ \hyperlink{mw__channel_8h_8308d484dffecd66a8c102fc81f614a1}{mwChannel\_\-getAddtlAccept} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em direct reference to the accept addtl information for a channel \item\end{CompactList}\item 
struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$ \hyperlink{mw__channel_8h_b444dcf0acf717ed89658325aa27ced6}{mwChannel\_\-getAddtlCreate} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em direct reference to the create addtl information for a channel \item\end{CompactList}\item 
struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ \hyperlink{mw__channel_8h_8ac75f17835471f500aa0f1219948765}{mwChannel\_\-getCipherInstance} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\item 
guint16 \hyperlink{mw__channel_8h_9eeee87028d25ba9addea3efa02409a4}{mwChannel\_\-getEncryptPolicy} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em Channel encryption policy. \item\end{CompactList}\item 
guint32 \hyperlink{mw__channel_8h_205fb45f4f128840da446802a5b8858f}{mwChannel\_\-getId} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em get the ID for a channel. \item\end{CompactList}\item 
guint32 \hyperlink{mw__channel_8h_6cc4dc53011417c27ad7d34b814ee74d}{mwChannel\_\-getOptions} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\item 
guint32 \hyperlink{mw__channel_8h_c2d6c9be2a7183b7db1548b737725fa0}{mwChannel\_\-getProtoType} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\item 
guint32 \hyperlink{mw__channel_8h_a59d3438ea8d7ddaa4aa66e7f96e0d25}{mwChannel\_\-getProtoVer} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\item 
struct \hyperlink{structmwService}{mwService} $\ast$ \hyperlink{mw__channel_8h_c1fea86d0accdaf564915e7a3d16084b}{mwChannel\_\-getService} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em get the service for a channel. \item\end{CompactList}\item 
gpointer \hyperlink{mw__channel_8h_9edb54daf4ae35b0eb5d622b2b0a2332}{mwChannel\_\-getServiceData} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em get service-specific data. \item\end{CompactList}\item 
guint32 \hyperlink{mw__channel_8h_852573bda2f2153ea7bdc3ce4e44ecba}{mwChannel\_\-getServiceId} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em get the ID of the service for a channel. \item\end{CompactList}\item 
struct \hyperlink{structmwSession}{mwSession} $\ast$ \hyperlink{mw__channel_8h_92bb2b0deb246e539f96c71f07a88836}{mwChannel\_\-getSession} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em get the session for a channel. \item\end{CompactList}\item 
enum \hyperlink{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11}{mwChannelState} \hyperlink{mw__channel_8h_7bcf55392672ce5cc803019884f0cf82}{mwChannel\_\-getState} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$)
\begin{CompactList}\small\item\em get the state of a channel \item\end{CompactList}\item 
gpointer \hyperlink{mw__channel_8h_5d3eb44fd65ec67e7e04c01ea49bdf2c}{mwChannel\_\-getStatistic} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, enum \hyperlink{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e}{mwChannelStatField} stat)
\begin{CompactList}\small\item\em obtain the value for a statistic field as a gpointer \item\end{CompactList}\item 
GList $\ast$ \hyperlink{mw__channel_8h_f5055c726c6d80ed0e451c5c95cc3794}{mwChannel\_\-getSupportedCipherInstances} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em the list of supported ciphers for a channel. \item\end{CompactList}\item 
struct \hyperlink{structmwLoginInfo}{mwLoginInfo} $\ast$ \hyperlink{mw__channel_8h_5049f4cfefc749fca12d8d226f098d00}{mwChannel\_\-getUser} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em User at the other end of the channel. \item\end{CompactList}\item 
struct \hyperlink{structmwChannel}{mwChannel} $\ast$ \hyperlink{mw__channel_8h_715a0d9c5d7ed3b81519d586cad7e73b}{mwChannel\_\-newIncoming} (struct \hyperlink{structmwChannelSet}{mwChannelSet} $\ast$, guint32 id)
\begin{CompactList}\small\item\em Create an incoming channel with the given channel id. \item\end{CompactList}\item 
struct \hyperlink{structmwChannel}{mwChannel} $\ast$ \hyperlink{mw__channel_8h_ca14ac73eda43fe18d5aa691c1705e11}{mwChannel\_\-newOutgoing} (struct \hyperlink{structmwChannelSet}{mwChannelSet} $\ast$)
\begin{CompactList}\small\item\em Create an outgoing channel. \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_d140721caa97992d7e64cd6504965946}{mwChannel\_\-populateSupportedCipherInstances} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em automatically adds instances of all ciphers in the session to the list of supported ciphers for a channel \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_45bfb6bb37d6db073c593bbfcc48af92}{mwChannel\_\-recv} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwMsgChannelSend}{mwMsgChannelSend} $\ast$msg)
\begin{CompactList}\small\item\em Feed data into a channel. \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_cdcc28872711d7b7cb17f403472448e5}{mwChannel\_\-recvAccept} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwMsgChannelAccept}{mwMsgChannelAccept} $\ast$msg)
\begin{CompactList}\small\item\em pass an accept message to a channel for handling \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_1172755c4bb709e9150691848ba4070f}{mwChannel\_\-recvCreate} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwMsgChannelCreate}{mwMsgChannelCreate} $\ast$msg)
\begin{CompactList}\small\item\em pass a create message to a channel for handling \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_0e66613f64ea68bebfae4c3e2fe1a50b}{mwChannel\_\-recvDestroy} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwMsgChannelDestroy}{mwMsgChannelDestroy} $\ast$msg)
\begin{CompactList}\small\item\em pass a destroy message to a channel for handling \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_288a0fc9ee0e2efbe16d6905a2bf158e}{mwChannel\_\-removeServiceData} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\item 
void \hyperlink{mw__channel_8h_ae6d4fb911cd040fb277d8caccf21d13}{mwChannel\_\-selectCipherInstance} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em select a cipher instance for a channel. \item\end{CompactList}\item 
int \hyperlink{mw__channel_8h_3c5c8c8fc12b5931e97e1456fac726cf}{mwChannel\_\-send} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 msg\_\-type, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$msg)
\begin{CompactList}\small\item\em Compose a send-on-channel message, encrypt it as per the channel's specification, and send it. \item\end{CompactList}\item 
int \hyperlink{mw__channel_8h_9680f1baac754a86449e2f416fa2ac27}{mwChannel\_\-sendEncrypted} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 msg\_\-type, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$msg, gboolean encrypt)
\begin{CompactList}\small\item\em Compose a send-on-channel message, and if encrypt is TRUE, encrypt it as per the channel's specification, and send it. \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_df361ad42cbffec92a393bc3e059c38e}{mwChannel\_\-setOptions} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 options)
\item 
void \hyperlink{mw__channel_8h_dc7007d3b03fed371cd1f2a51321f04e}{mwChannel\_\-setProtoType} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 proto\_\-type)
\item 
void \hyperlink{mw__channel_8h_7f43ceb7857fadd26d24ad1294ba4d8b}{mwChannel\_\-setProtoVer} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, guint32 proto\_\-ver)
\item 
void \hyperlink{mw__channel_8h_730aaae4bae3fdfe485cf4e62510bdd7}{mwChannel\_\-setService} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, struct \hyperlink{structmwService}{mwService} $\ast$srvc)
\begin{CompactList}\small\item\em associate a channel with an owning service \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_e424543ba6d270f04d4819a7b77b5d47}{mwChannel\_\-setServiceData} (struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan, gpointer data, GDestroyNotify clean)
\begin{CompactList}\small\item\em set service-specific data. \item\end{CompactList}\item 
void \hyperlink{mw__channel_8h_36ca1279d6e68a1e86a9f0126bc545cc}{mwChannelSet\_\-free} (struct \hyperlink{structmwChannelSet}{mwChannelSet} $\ast$)
\begin{CompactList}\small\item\em Clear and deallocate a channel set. \item\end{CompactList}\item 
struct \hyperlink{structmwChannelSet}{mwChannelSet} $\ast$ \hyperlink{mw__channel_8h_78d3c4f046b9b2627f82d9c7a5238048}{mwChannelSet\_\-new} (struct \hyperlink{structmwSession}{mwSession} $\ast$)
\begin{CompactList}\small\item\em Allocate and initialize a channel set for a session. \item\end{CompactList}\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{mw__channel_8h_1a2154c83a846c017653a2ee8c1aaa35}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!MW\_\-MASTER\_\-CHANNEL\_\-ID@{MW\_\-MASTER\_\-CHANNEL\_\-ID}}
\index{MW\_\-MASTER\_\-CHANNEL\_\-ID@{MW\_\-MASTER\_\-CHANNEL\_\-ID}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MW\_\-MASTER\_\-CHANNEL\_\-ID~0x00000000}}
\label{mw__channel_8h_1a2154c83a846c017653a2ee8c1aaa35}


special ID indicating the master channel 

\hypertarget{mw__channel_8h_74bd8e3a8a90d421b1a9a7e4b7acec89}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-idIsIncoming@{mwChannel\_\-idIsIncoming}}
\index{mwChannel\_\-idIsIncoming@{mwChannel\_\-idIsIncoming}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define mwChannel\_\-idIsIncoming(id)~(! mwChannel\_\-idIsOutgoing(id))}}
\label{mw__channel_8h_74bd8e3a8a90d421b1a9a7e4b7acec89}


non-zero if a channel id appears to be that of an incoming channel 

\hypertarget{mw__channel_8h_1c4fa767a8f09e32aaa8b180c1b836f5}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-idIsOutgoing@{mwChannel\_\-idIsOutgoing}}
\index{mwChannel\_\-idIsOutgoing@{mwChannel\_\-idIsOutgoing}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define mwChannel\_\-idIsOutgoing(id)~(! (0x80000000 \& (id)))}}
\label{mw__channel_8h_1c4fa767a8f09e32aaa8b180c1b836f5}


non-zero if a channel id appears to be that of an outgoing channel 

\hypertarget{mw__channel_8h_ea68737cfe6d90e09b13ba1b95b9c633}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-isIncoming@{mwChannel\_\-isIncoming}}
\index{mwChannel\_\-isIncoming@{mwChannel\_\-isIncoming}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define mwChannel\_\-isIncoming(chan)~mwChannel\_\-idIsIncoming(mwChannel\_\-getId(chan))}}
\label{mw__channel_8h_ea68737cfe6d90e09b13ba1b95b9c633}


non-zero if a channel appears to be an incoming channel 

\hypertarget{mw__channel_8h_f8dd8d1088786774775243383f8f8f28}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-isOutgoing@{mwChannel\_\-isOutgoing}}
\index{mwChannel\_\-isOutgoing@{mwChannel\_\-isOutgoing}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define mwChannel\_\-isOutgoing(chan)~mwChannel\_\-idIsOutgoing(mwChannel\_\-getId(chan))}}
\label{mw__channel_8h_f8dd8d1088786774775243383f8f8f28}


non-zero if a channel appears to be an outgoing channel 

\hypertarget{mw__channel_8h_cb79280fcff820ba79c7f2a9b9dbe0e0}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-isState@{mwChannel\_\-isState}}
\index{mwChannel\_\-isState@{mwChannel\_\-isState}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define mwChannel\_\-isState(chan, \/  {\bf state})~(mwChannel\_\-getState(chan) == ({\bf state}))}}
\label{mw__channel_8h_cb79280fcff820ba79c7f2a9b9dbe0e0}




\subsection{Enumeration Type Documentation}
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelState@{mwChannelState}}
\index{mwChannelState@{mwChannelState}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwChannelState}}}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11}


channel status 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{mwChannel\_\-NEW@{mwChannel\_\-NEW}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-NEW@{mwChannel\_\-NEW}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd110015e6ab100dcc9072046d4fbccf1c5c}{
mwChannel\_\-NEW}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd110015e6ab100dcc9072046d4fbccf1c5c}
}]channel is newly allocated, in the pool \index{mwChannel\_\-INIT@{mwChannel\_\-INIT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-INIT@{mwChannel\_\-INIT}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1181856c37ab30b5c5dc918230e74b41be}{
mwChannel\_\-INIT}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1181856c37ab30b5c5dc918230e74b41be}
}]channel is being prepared, out of the pool \index{mwChannel\_\-WAIT@{mwChannel\_\-WAIT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-WAIT@{mwChannel\_\-WAIT}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11cc17dbc14dcca5f07db0e1086b1787d7}{
mwChannel\_\-WAIT}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11cc17dbc14dcca5f07db0e1086b1787d7}
}]channel is waiting for accept \index{mwChannel\_\-OPEN@{mwChannel\_\-OPEN}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-OPEN@{mwChannel\_\-OPEN}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd119b079efae54c7ce19a75cc72bb4bdf1d}{
mwChannel\_\-OPEN}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd119b079efae54c7ce19a75cc72bb4bdf1d}
}]channel is accepted and open \index{mwChannel\_\-DESTROY@{mwChannel\_\-DESTROY}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-DESTROY@{mwChannel\_\-DESTROY}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd114dbdbd31d9ff0fb6b973a665ab28a640}{
mwChannel\_\-DESTROY}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd114dbdbd31d9ff0fb6b973a665ab28a640}
}]channel is being destroyed \index{mwChannel\_\-ERROR@{mwChannel\_\-ERROR}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-ERROR@{mwChannel\_\-ERROR}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1113307644c3c44174b3374e165e4bd609}{
mwChannel\_\-ERROR}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd1113307644c3c44174b3374e165e4bd609}
}]channel is being destroyed due to error \index{mwChannel\_\-UNKNOWN@{mwChannel\_\-UNKNOWN}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-UNKNOWN@{mwChannel\_\-UNKNOWN}}\item[{\em 
\hypertarget{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11037260bf612b5b449b9dfc25f14d863c}{
mwChannel\_\-UNKNOWN}
\label{mw__channel_8h_2f9ff901fd7b6e0f92c4f651b209fd11037260bf612b5b449b9dfc25f14d863c}
}]unknown state, or error determining state \end{description}
\end{Desc}

\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStatField@{mwChannelStatField}}
\index{mwChannelStatField@{mwChannelStatField}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwChannelStatField}}}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e}


channel statistic fields. 

\begin{Desc}
\item[See also:]\hyperlink{mw__channel_8h_5d3eb44fd65ec67e7e04c01ea49bdf2c}{mwChannel\_\-getStatistic} \end{Desc}
\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{mwChannelStat\_\-MSG\_\-SENT@{mwChannelStat\_\-MSG\_\-SENT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-MSG\_\-SENT@{mwChannelStat\_\-MSG\_\-SENT}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e2fb930374933a4ae3bcbb59c38100453}{
mwChannelStat\_\-MSG\_\-SENT}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e2fb930374933a4ae3bcbb59c38100453}
}]total send-on-chan messages sent \index{mwChannelStat\_\-MSG\_\-RECV@{mwChannelStat\_\-MSG\_\-RECV}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-MSG\_\-RECV@{mwChannelStat\_\-MSG\_\-RECV}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e0b9cd0c35eae32dde00d1757863c0c72}{
mwChannelStat\_\-MSG\_\-RECV}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e0b9cd0c35eae32dde00d1757863c0c72}
}]total send-on-chan messages received \index{mwChannelStat\_\-U\_\-BYTES\_\-SENT@{mwChannelStat\_\-U\_\-BYTES\_\-SENT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-U\_\-BYTES\_\-SENT@{mwChannelStat\_\-U\_\-BYTES\_\-SENT}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5cb8465381680632b7f9f12c35e36b36}{
mwChannelStat\_\-U\_\-BYTES\_\-SENT}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5cb8465381680632b7f9f12c35e36b36}
}]total bytes sent, pre-encryption \index{mwChannelStat\_\-U\_\-BYTES\_\-RECV@{mwChannelStat\_\-U\_\-BYTES\_\-RECV}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-U\_\-BYTES\_\-RECV@{mwChannelStat\_\-U\_\-BYTES\_\-RECV}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e76fcf9b81600e77219e91476087127ca}{
mwChannelStat\_\-U\_\-BYTES\_\-RECV}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e76fcf9b81600e77219e91476087127ca}
}]total bytes received, post-decryption \index{mwChannelStat\_\-OPENED\_\-AT@{mwChannelStat\_\-OPENED\_\-AT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-OPENED\_\-AT@{mwChannelStat\_\-OPENED\_\-AT}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e89b26adcb1a6ecb4cf7f871856c597ce}{
mwChannelStat\_\-OPENED\_\-AT}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e89b26adcb1a6ecb4cf7f871856c597ce}
}]time when channel was opened \index{mwChannelStat\_\-CLOSED\_\-AT@{mwChannelStat\_\-CLOSED\_\-AT}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelStat\_\-CLOSED\_\-AT@{mwChannelStat\_\-CLOSED\_\-AT}}\item[{\em 
\hypertarget{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5eef1f4cfa0960802e63d5c98c1fc987}{
mwChannelStat\_\-CLOSED\_\-AT}
\label{mw__channel_8h_e48ef93585f681efb2f9e4eb702c365e5eef1f4cfa0960802e63d5c98c1fc987}
}]time when channel was closed \end{description}
\end{Desc}

\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778dd}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncryptPolicy@{mwEncryptPolicy}}
\index{mwEncryptPolicy@{mwEncryptPolicy}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwEncryptPolicy}}}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778dd}


Policy for a channel, dictating what sort of encryption should be used, if any, and when. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{mwEncrypt\_\-NONE@{mwEncrypt\_\-NONE}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncrypt\_\-NONE@{mwEncrypt\_\-NONE}}\item[{\em 
\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778dd8fb49fce96dafa93f4574079bcefefcd}{
mwEncrypt\_\-NONE}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778dd8fb49fce96dafa93f4574079bcefefcd}
}]encrypt none \index{mwEncrypt\_\-WHATEVER@{mwEncrypt\_\-WHATEVER}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncrypt\_\-WHATEVER@{mwEncrypt\_\-WHATEVER}}\item[{\em 
\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778dd23970e8fbf808d49e753b76edd2f7dac}{
mwEncrypt\_\-WHATEVER}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778dd23970e8fbf808d49e753b76edd2f7dac}
}]encrypt whatever you want \index{mwEncrypt\_\-ALL@{mwEncrypt\_\-ALL}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncrypt\_\-ALL@{mwEncrypt\_\-ALL}}\item[{\em 
\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778dd751e7884abd7fff5bf60df3be83acb49}{
mwEncrypt\_\-ALL}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778dd751e7884abd7fff5bf60df3be83acb49}
}]encrypt all, any cipher \index{mwEncrypt\_\-RC2\_\-40@{mwEncrypt\_\-RC2\_\-40}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncrypt\_\-RC2\_\-40@{mwEncrypt\_\-RC2\_\-40}}\item[{\em 
\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778ddb501a631c7ce9cf2afb4c3ae80a5f228}{
mwEncrypt\_\-RC2\_\-40}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778ddb501a631c7ce9cf2afb4c3ae80a5f228}
}]encrypt all, RC2/40 cipher \index{mwEncrypt\_\-RC2\_\-128@{mwEncrypt\_\-RC2\_\-128}!mw\_\-channel.h@{mw\_\-channel.h}}\index{mw\_\-channel.h@{mw\_\-channel.h}!mwEncrypt\_\-RC2\_\-128@{mwEncrypt\_\-RC2\_\-128}}\item[{\em 
\hypertarget{mw__channel_8h_f1a96846496c5953b72b8002821778dd24d43c164f072dfdb19b9b3b739b5e2c}{
mwEncrypt\_\-RC2\_\-128}
\label{mw__channel_8h_f1a96846496c5953b72b8002821778dd24d43c164f072dfdb19b9b3b739b5e2c}
}]encrypt all, RC2/128 cipher \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{mw__channel_8h_8c72269dfed1ad1a32a2f44501c3961a}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-accept@{mwChannel\_\-accept}}
\index{mwChannel\_\-accept@{mwChannel\_\-accept}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwChannel\_\-accept (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_8c72269dfed1ad1a32a2f44501c3961a}


Formally accept an incoming channel. 

Instructs the session to send a channel accept message to the server, and to mark the channel as being OPEN. \hypertarget{mw__channel_8h_7c85be3b885f7bb2119707e78c9f1c1d}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-addSupportedCipherInstance@{mwChannel\_\-addSupportedCipherInstance}}
\index{mwChannel\_\-addSupportedCipherInstance@{mwChannel\_\-addSupportedCipherInstance}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-addSupportedCipherInstance (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwCipherInstance} $\ast$ {\em ci})}}
\label{mw__channel_8h_7c85be3b885f7bb2119707e78c9f1c1d}


add a cipher instance to a channel's list of supported ciphers. 

Channel must be NEW. \hypertarget{mw__channel_8h_c0b5dba71d6c2ac2780b094bae9bda13}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-create@{mwChannel\_\-create}}
\index{mwChannel\_\-create@{mwChannel\_\-create}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwChannel\_\-create (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_c0b5dba71d6c2ac2780b094bae9bda13}


Formally open a channel. 

For outgoing channels: instruct the session to send a channel create message to the server, and to mark the channel (which must be in INIT status) as being in WAIT status.

For incoming channels: configures the channel according to options in the channel create message. Marks the channel as being in WAIT status \hypertarget{mw__channel_8h_cbfd68a6393902b1e396c19086cb8703}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-destroy@{mwChannel\_\-destroy}}
\index{mwChannel\_\-destroy@{mwChannel\_\-destroy}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwChannel\_\-destroy (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em reason}, \/  struct {\bf mwOpaque} $\ast$ {\em data})}}
\label{mw__channel_8h_cbfd68a6393902b1e396c19086cb8703}


Destroy a channel. 

Sends a channel-destroy message to the server, and perform cleanup to remove the channel.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em chan}]the channel to destroy \item[{\em reason}]the reason code for closing the channel \item[{\em data}]optional additional information \end{description}
\end{Desc}
\hypertarget{mw__channel_8h_dbaba2dd85c52344f8ff813673945664}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-find@{mwChannel\_\-find}}
\index{mwChannel\_\-find@{mwChannel\_\-find}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwChannel}$\ast$ mwChannel\_\-find (struct {\bf mwChannelSet} $\ast$ {\em cs}, \/  guint32 {\em chan})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_dbaba2dd85c52344f8ff813673945664}


Obtain a reference to a channel by its id. 

\begin{Desc}
\item[Returns:]the channel matching chan, or NULL \end{Desc}
\hypertarget{mw__channel_8h_8308d484dffecd66a8c102fc81f614a1}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getAddtlAccept@{mwChannel\_\-getAddtlAccept}}
\index{mwChannel\_\-getAddtlAccept@{mwChannel\_\-getAddtlAccept}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwOpaque}$\ast$ mwChannel\_\-getAddtlAccept (struct {\bf mwChannel} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_8308d484dffecd66a8c102fc81f614a1}


direct reference to the accept addtl information for a channel 

\hypertarget{mw__channel_8h_b444dcf0acf717ed89658325aa27ced6}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getAddtlCreate@{mwChannel\_\-getAddtlCreate}}
\index{mwChannel\_\-getAddtlCreate@{mwChannel\_\-getAddtlCreate}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwOpaque}$\ast$ mwChannel\_\-getAddtlCreate (struct {\bf mwChannel} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_b444dcf0acf717ed89658325aa27ced6}


direct reference to the create addtl information for a channel 

\hypertarget{mw__channel_8h_8ac75f17835471f500aa0f1219948765}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getCipherInstance@{mwChannel\_\-getCipherInstance}}
\index{mwChannel\_\-getCipherInstance@{mwChannel\_\-getCipherInstance}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwCipherInstance}$\ast$ mwChannel\_\-getCipherInstance (struct {\bf mwChannel} $\ast$ {\em chan})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_8ac75f17835471f500aa0f1219948765}


\hypertarget{mw__channel_8h_9eeee87028d25ba9addea3efa02409a4}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getEncryptPolicy@{mwChannel\_\-getEncryptPolicy}}
\index{mwChannel\_\-getEncryptPolicy@{mwChannel\_\-getEncryptPolicy}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint16 mwChannel\_\-getEncryptPolicy (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_9eeee87028d25ba9addea3efa02409a4}


Channel encryption policy. 

Cannot currently be set, used internally to automatically negotiate ciphers. Future revisions may allow this to be specified in a new channel to dictate channel encryption.

\begin{Desc}
\item[See also:]enum \hyperlink{mw__channel_8h_f1a96846496c5953b72b8002821778dd}{mwEncryptPolicy} \end{Desc}
\hypertarget{mw__channel_8h_205fb45f4f128840da446802a5b8858f}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getId@{mwChannel\_\-getId}}
\index{mwChannel\_\-getId@{mwChannel\_\-getId}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwChannel\_\-getId (struct {\bf mwChannel} $\ast$)}}
\label{mw__channel_8h_205fb45f4f128840da446802a5b8858f}


get the ID for a channel. 

0x00 indicates an error, as that is not a permissible value \hypertarget{mw__channel_8h_6cc4dc53011417c27ad7d34b814ee74d}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getOptions@{mwChannel\_\-getOptions}}
\index{mwChannel\_\-getOptions@{mwChannel\_\-getOptions}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwChannel\_\-getOptions (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_6cc4dc53011417c27ad7d34b814ee74d}


\hypertarget{mw__channel_8h_c2d6c9be2a7183b7db1548b737725fa0}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getProtoType@{mwChannel\_\-getProtoType}}
\index{mwChannel\_\-getProtoType@{mwChannel\_\-getProtoType}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwChannel\_\-getProtoType (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_c2d6c9be2a7183b7db1548b737725fa0}


\hypertarget{mw__channel_8h_a59d3438ea8d7ddaa4aa66e7f96e0d25}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getProtoVer@{mwChannel\_\-getProtoVer}}
\index{mwChannel\_\-getProtoVer@{mwChannel\_\-getProtoVer}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwChannel\_\-getProtoVer (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_a59d3438ea8d7ddaa4aa66e7f96e0d25}


\hypertarget{mw__channel_8h_c1fea86d0accdaf564915e7a3d16084b}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getService@{mwChannel\_\-getService}}
\index{mwChannel\_\-getService@{mwChannel\_\-getService}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwService}$\ast$ mwChannel\_\-getService (struct {\bf mwChannel} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_c1fea86d0accdaf564915e7a3d16084b}


get the service for a channel. 

This may be NULL for NEW channels \hypertarget{mw__channel_8h_9edb54daf4ae35b0eb5d622b2b0a2332}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getServiceData@{mwChannel\_\-getServiceData}}
\index{mwChannel\_\-getServiceData@{mwChannel\_\-getServiceData}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gpointer mwChannel\_\-getServiceData (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_9edb54daf4ae35b0eb5d622b2b0a2332}


get service-specific data. 

This is for use by service implementations to easily associate information with the channel \hypertarget{mw__channel_8h_852573bda2f2153ea7bdc3ce4e44ecba}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getServiceId@{mwChannel\_\-getServiceId}}
\index{mwChannel\_\-getServiceId@{mwChannel\_\-getServiceId}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint32 mwChannel\_\-getServiceId (struct {\bf mwChannel} $\ast$)}}
\label{mw__channel_8h_852573bda2f2153ea7bdc3ce4e44ecba}


get the ID of the service for a channel. 

This may be 0x00 for NEW channels \hypertarget{mw__channel_8h_92bb2b0deb246e539f96c71f07a88836}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getSession@{mwChannel\_\-getSession}}
\index{mwChannel\_\-getSession@{mwChannel\_\-getSession}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwSession}$\ast$ mwChannel\_\-getSession (struct {\bf mwChannel} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_92bb2b0deb246e539f96c71f07a88836}


get the session for a channel. 

\hypertarget{mw__channel_8h_7bcf55392672ce5cc803019884f0cf82}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getState@{mwChannel\_\-getState}}
\index{mwChannel\_\-getState@{mwChannel\_\-getState}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwChannelState} mwChannel\_\-getState (struct {\bf mwChannel} $\ast$)}}
\label{mw__channel_8h_7bcf55392672ce5cc803019884f0cf82}


get the state of a channel 

\hypertarget{mw__channel_8h_5d3eb44fd65ec67e7e04c01ea49bdf2c}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getStatistic@{mwChannel\_\-getStatistic}}
\index{mwChannel\_\-getStatistic@{mwChannel\_\-getStatistic}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gpointer mwChannel\_\-getStatistic (struct {\bf mwChannel} $\ast$ {\em chan}, \/  enum {\bf mwChannelStatField} {\em stat})}}
\label{mw__channel_8h_5d3eb44fd65ec67e7e04c01ea49bdf2c}


obtain the value for a statistic field as a gpointer 

\hypertarget{mw__channel_8h_f5055c726c6d80ed0e451c5c95cc3794}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getSupportedCipherInstances@{mwChannel\_\-getSupportedCipherInstances}}
\index{mwChannel\_\-getSupportedCipherInstances@{mwChannel\_\-getSupportedCipherInstances}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}GList$\ast$ mwChannel\_\-getSupportedCipherInstances (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_f5055c726c6d80ed0e451c5c95cc3794}


the list of supported ciphers for a channel. 

This list will be empty once a cipher has been selected for the channel \hypertarget{mw__channel_8h_5049f4cfefc749fca12d8d226f098d00}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-getUser@{mwChannel\_\-getUser}}
\index{mwChannel\_\-getUser@{mwChannel\_\-getUser}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwLoginInfo}$\ast$ mwChannel\_\-getUser (struct {\bf mwChannel} $\ast$ {\em chan})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_5049f4cfefc749fca12d8d226f098d00}


User at the other end of the channel. 

The target user for outgoing channels, the creator for incoming channels \hypertarget{mw__channel_8h_715a0d9c5d7ed3b81519d586cad7e73b}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-newIncoming@{mwChannel\_\-newIncoming}}
\index{mwChannel\_\-newIncoming@{mwChannel\_\-newIncoming}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwChannel}$\ast$ mwChannel\_\-newIncoming (struct {\bf mwChannelSet} $\ast$, \/  guint32 {\em id})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_715a0d9c5d7ed3b81519d586cad7e73b}


Create an incoming channel with the given channel id. 

Channel's state will be set to WAIT. Primarily for use in mw\_\-session \hypertarget{mw__channel_8h_ca14ac73eda43fe18d5aa691c1705e11}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-newOutgoing@{mwChannel\_\-newOutgoing}}
\index{mwChannel\_\-newOutgoing@{mwChannel\_\-newOutgoing}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwChannel}$\ast$ mwChannel\_\-newOutgoing (struct {\bf mwChannelSet} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_ca14ac73eda43fe18d5aa691c1705e11}


Create an outgoing channel. 

Its channel ID will be generated by the owning channel set. Channel's state will be set to INIT \hypertarget{mw__channel_8h_d140721caa97992d7e64cd6504965946}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-populateSupportedCipherInstances@{mwChannel\_\-populateSupportedCipherInstances}}
\index{mwChannel\_\-populateSupportedCipherInstances@{mwChannel\_\-populateSupportedCipherInstances}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-populateSupportedCipherInstances (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_d140721caa97992d7e64cd6504965946}


automatically adds instances of all ciphers in the session to the list of supported ciphers for a channel 

\hypertarget{mw__channel_8h_45bfb6bb37d6db073c593bbfcc48af92}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-recv@{mwChannel\_\-recv}}
\index{mwChannel\_\-recv@{mwChannel\_\-recv}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-recv (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwMsgChannelSend} $\ast$ {\em msg})}}
\label{mw__channel_8h_45bfb6bb37d6db073c593bbfcc48af92}


Feed data into a channel. 

\hypertarget{mw__channel_8h_cdcc28872711d7b7cb17f403472448e5}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-recvAccept@{mwChannel\_\-recvAccept}}
\index{mwChannel\_\-recvAccept@{mwChannel\_\-recvAccept}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-recvAccept (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwMsgChannelAccept} $\ast$ {\em msg})}}
\label{mw__channel_8h_cdcc28872711d7b7cb17f403472448e5}


pass an accept message to a channel for handling 

\hypertarget{mw__channel_8h_1172755c4bb709e9150691848ba4070f}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-recvCreate@{mwChannel\_\-recvCreate}}
\index{mwChannel\_\-recvCreate@{mwChannel\_\-recvCreate}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-recvCreate (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwMsgChannelCreate} $\ast$ {\em msg})}}
\label{mw__channel_8h_1172755c4bb709e9150691848ba4070f}


pass a create message to a channel for handling 

\hypertarget{mw__channel_8h_0e66613f64ea68bebfae4c3e2fe1a50b}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-recvDestroy@{mwChannel\_\-recvDestroy}}
\index{mwChannel\_\-recvDestroy@{mwChannel\_\-recvDestroy}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-recvDestroy (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwMsgChannelDestroy} $\ast$ {\em msg})}}
\label{mw__channel_8h_0e66613f64ea68bebfae4c3e2fe1a50b}


pass a destroy message to a channel for handling 

\hypertarget{mw__channel_8h_288a0fc9ee0e2efbe16d6905a2bf158e}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-removeServiceData@{mwChannel\_\-removeServiceData}}
\index{mwChannel\_\-removeServiceData@{mwChannel\_\-removeServiceData}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-removeServiceData (struct {\bf mwChannel} $\ast$ {\em chan})}}
\label{mw__channel_8h_288a0fc9ee0e2efbe16d6905a2bf158e}


\hypertarget{mw__channel_8h_ae6d4fb911cd040fb277d8caccf21d13}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-selectCipherInstance@{mwChannel\_\-selectCipherInstance}}
\index{mwChannel\_\-selectCipherInstance@{mwChannel\_\-selectCipherInstance}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-selectCipherInstance (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwCipherInstance} $\ast$ {\em ci})}}
\label{mw__channel_8h_ae6d4fb911cd040fb277d8caccf21d13}


select a cipher instance for a channel. 

A NULL instance indicates that no encryption should be used. \hypertarget{mw__channel_8h_3c5c8c8fc12b5931e97e1456fac726cf}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-send@{mwChannel\_\-send}}
\index{mwChannel\_\-send@{mwChannel\_\-send}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwChannel\_\-send (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em msg\_\-type}, \/  struct {\bf mwOpaque} $\ast$ {\em msg})}}
\label{mw__channel_8h_3c5c8c8fc12b5931e97e1456fac726cf}


Compose a send-on-channel message, encrypt it as per the channel's specification, and send it. 

\hypertarget{mw__channel_8h_9680f1baac754a86449e2f416fa2ac27}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-sendEncrypted@{mwChannel\_\-sendEncrypted}}
\index{mwChannel\_\-sendEncrypted@{mwChannel\_\-sendEncrypted}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwChannel\_\-sendEncrypted (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em msg\_\-type}, \/  struct {\bf mwOpaque} $\ast$ {\em msg}, \/  gboolean {\em encrypt})}}
\label{mw__channel_8h_9680f1baac754a86449e2f416fa2ac27}


Compose a send-on-channel message, and if encrypt is TRUE, encrypt it as per the channel's specification, and send it. 

\hypertarget{mw__channel_8h_df361ad42cbffec92a393bc3e059c38e}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-setOptions@{mwChannel\_\-setOptions}}
\index{mwChannel\_\-setOptions@{mwChannel\_\-setOptions}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-setOptions (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em options})}}
\label{mw__channel_8h_df361ad42cbffec92a393bc3e059c38e}


\hypertarget{mw__channel_8h_dc7007d3b03fed371cd1f2a51321f04e}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-setProtoType@{mwChannel\_\-setProtoType}}
\index{mwChannel\_\-setProtoType@{mwChannel\_\-setProtoType}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-setProtoType (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em proto\_\-type})}}
\label{mw__channel_8h_dc7007d3b03fed371cd1f2a51321f04e}


\hypertarget{mw__channel_8h_7f43ceb7857fadd26d24ad1294ba4d8b}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-setProtoVer@{mwChannel\_\-setProtoVer}}
\index{mwChannel\_\-setProtoVer@{mwChannel\_\-setProtoVer}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-setProtoVer (struct {\bf mwChannel} $\ast$ {\em chan}, \/  guint32 {\em proto\_\-ver})}}
\label{mw__channel_8h_7f43ceb7857fadd26d24ad1294ba4d8b}


\hypertarget{mw__channel_8h_730aaae4bae3fdfe485cf4e62510bdd7}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-setService@{mwChannel\_\-setService}}
\index{mwChannel\_\-setService@{mwChannel\_\-setService}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-setService (struct {\bf mwChannel} $\ast$ {\em chan}, \/  struct {\bf mwService} $\ast$ {\em srvc})}}
\label{mw__channel_8h_730aaae4bae3fdfe485cf4e62510bdd7}


associate a channel with an owning service 

\hypertarget{mw__channel_8h_e424543ba6d270f04d4819a7b77b5d47}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannel\_\-setServiceData@{mwChannel\_\-setServiceData}}
\index{mwChannel\_\-setServiceData@{mwChannel\_\-setServiceData}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannel\_\-setServiceData (struct {\bf mwChannel} $\ast$ {\em chan}, \/  gpointer {\em data}, \/  GDestroyNotify {\em clean})}}
\label{mw__channel_8h_e424543ba6d270f04d4819a7b77b5d47}


set service-specific data. 

This is for use by service implementations to easily associate information with the channel \hypertarget{mw__channel_8h_36ca1279d6e68a1e86a9f0126bc545cc}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelSet\_\-free@{mwChannelSet\_\-free}}
\index{mwChannelSet\_\-free@{mwChannelSet\_\-free}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwChannelSet\_\-free (struct {\bf mwChannelSet} $\ast$)}}
\label{mw__channel_8h_36ca1279d6e68a1e86a9f0126bc545cc}


Clear and deallocate a channel set. 

Closes, clears, and frees all contained channels. \hypertarget{mw__channel_8h_78d3c4f046b9b2627f82d9c7a5238048}{
\index{mw\_\-channel.h@{mw\_\-channel.h}!mwChannelSet\_\-new@{mwChannelSet\_\-new}}
\index{mwChannelSet\_\-new@{mwChannelSet\_\-new}!mw_channel.h@{mw\_\-channel.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwChannelSet}$\ast$ mwChannelSet\_\-new (struct {\bf mwSession} $\ast$)\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__channel_8h_78d3c4f046b9b2627f82d9c7a5238048}


Allocate and initialize a channel set for a session. 

