| 1 | /* |
| 2 | * Copyright (C) 2004-2005 by Objective Systems, Inc. |
| 3 | * |
| 4 | * This software is furnished under an open source license and may be |
| 5 | * used and copied only in accordance with the terms of this license. |
| 6 | * The text of the license may generally be found in the root |
| 7 | * directory of this installation in the COPYING file. It |
| 8 | * can also be viewed online at the following URL: |
| 9 | * |
| 10 | * http://www.obj-sys.com/open/license.html |
| 11 | * |
| 12 | * Any redistributions of this file including modified versions must |
| 13 | * maintain this copyright notice. |
| 14 | * |
| 15 | *****************************************************************************/ |
| 16 | |
| 17 | /** |
| 18 | * @file oochannels.h |
| 19 | * This file contains functions to create and use channels. |
| 20 | */ |
| 21 | #ifndef _OOCHANNELS_H_ |
| 22 | #define _OOCHANNELS_H_ |
| 23 | |
| 24 | #include "H323-MESSAGES.h" |
| 25 | #include "MULTIMEDIA-SYSTEM-CONTROL.h" |
| 26 | #include "ootypes.h" |
| 27 | #include "ooSocket.h" |
| 28 | #include "ooCalls.h" |
| 29 | |
| 30 | #define OORECEIVER 1 |
| 31 | #define OOTRANSMITTER 2 |
| 32 | #define OODUPLEX 3 |
| 33 | |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" { |
| 36 | #endif |
| 37 | |
| 38 | #ifndef EXTERN |
| 39 | #ifdef MAKE_DLL |
| 40 | #define EXTERN __declspec(dllexport) |
| 41 | #else |
| 42 | #define EXTERN |
| 43 | #endif /* MAKE_DLL */ |
| 44 | #endif /* EXTERN */ |
| 45 | |
| 46 | struct OOH323CallData; |
| 47 | struct Q931Message; |
| 48 | |
| 49 | /** |
| 50 | * @defgroup channels Channel Management |
| 51 | * @{ |
| 52 | */ |
| 53 | /** |
| 54 | * This function is used to create a listener for incoming calls. |
| 55 | * |
| 56 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 57 | */ |
| 58 | EXTERN int ooCreateH323Listener(void); |
| 59 | |
| 60 | /** |
| 61 | * This function is used to create a listener for incoming H.245 connections. |
| 62 | * @param call Pointer to call for which H.245 listener has to be created |
| 63 | * |
| 64 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 65 | */ |
| 66 | EXTERN int ooCreateH245Listener(struct OOH323CallData *call); |
| 67 | |
| 68 | /** |
| 69 | * This function is used to close an H245 listener for a call. |
| 70 | * @param call Pointer to call for which H245 Listener has to be closed. |
| 71 | * |
| 72 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 73 | */ |
| 74 | EXTERN int ooCloseH245Listener(struct OOH323CallData *call); |
| 75 | |
| 76 | /** |
| 77 | * This function is used to accept incoming H.225 connections. |
| 78 | * |
| 79 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 80 | */ |
| 81 | EXTERN int ooAcceptH225Connection(void); |
| 82 | |
| 83 | /** |
| 84 | * This function is used to accept an incoming H.245 connection. |
| 85 | * @param call Pointer to a call for which H.245 connection request has |
| 86 | * arrived. |
| 87 | * |
| 88 | * @return OO_OK, on succes. OO_FAILED, on failure. |
| 89 | */ |
| 90 | EXTERN int ooAcceptH245Connection(struct OOH323CallData *call); |
| 91 | |
| 92 | /** |
| 93 | * This function is used to create an H.225 connection to the remote end point. |
| 94 | * @param call Pointer to the call for which H.225 connection has to be |
| 95 | * setup. |
| 96 | * @return OO_OK, on succes. OO_FAILED, on failure. |
| 97 | */ |
| 98 | EXTERN int ooCreateH225Connection(struct OOH323CallData *call); |
| 99 | |
| 100 | /** |
| 101 | * This function is used to setup an H.245 connection with the remote endpoint |
| 102 | * for control negotiations. |
| 103 | * @param call Pointer to call for which H.245 connection has to be setup. |
| 104 | * |
| 105 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 106 | */ |
| 107 | EXTERN int ooCreateH245Connection(struct OOH323CallData *call); |
| 108 | |
| 109 | /** |
| 110 | * This function is used to close an H.225 connection |
| 111 | * @param call Pointer to the call for which H.225 connection has to be |
| 112 | * closed. |
| 113 | * |
| 114 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 115 | */ |
| 116 | EXTERN int ooCloseH225Connection(struct OOH323CallData *call); |
| 117 | |
| 118 | /** |
| 119 | * This function is used to close an H.245 connection for a call. |
| 120 | * |
| 121 | * @param call Pointer to call for which H.245 connection has |
| 122 | * to be closed. |
| 123 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 124 | */ |
| 125 | EXTERN int ooCloseH245Connection(struct OOH323CallData *call); |
| 126 | |
| 127 | /** |
| 128 | * This function is used to start monitoring channels for the calls. It has |
| 129 | * an infinite loop which uses select to monitor various channels. |
| 130 | * |
| 131 | */ |
| 132 | EXTERN int ooMonitorChannels(void); |
| 133 | EXTERN int ooMonitorCmdChannels(void); |
| 134 | EXTERN int ooMonitorCallChannels(OOH323CallData *); |
| 135 | |
| 136 | /** |
| 137 | * This function is called to stop the monitor channels event loop. |
| 138 | * It cleans up all the active calls before stopping the monitor. |
| 139 | * |
| 140 | * @return OO_OK, on success. OO_FAILED, on failure |
| 141 | */ |
| 142 | EXTERN int ooStopMonitorCalls(void); |
| 143 | EXTERN void ooStopMonitorCallChannels(OOH323CallData *); |
| 144 | |
| 145 | /** |
| 146 | * This function is used to receive an H.2250 message received on a calls |
| 147 | * H.225 channel. It receives the message, decodes it and calls |
| 148 | * 'ooHandleH2250Message' to process the message. |
| 149 | * @param call Pointer to the call for which the message has to be |
| 150 | * received. |
| 151 | * |
| 152 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 153 | */ |
| 154 | EXTERN int ooH2250Receive(struct OOH323CallData *call); |
| 155 | |
| 156 | /** |
| 157 | * This function is used to receive an H.245 message received on a calls |
| 158 | * H.245 channel. It receives the message, decodes it and calls |
| 159 | * 'ooHandleH245Message' to process it. |
| 160 | * @param call Pointer to the call for which the message has to be |
| 161 | * received. |
| 162 | * |
| 163 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 164 | */ |
| 165 | EXTERN int ooH245Receive(struct OOH323CallData *call); |
| 166 | |
| 167 | /** |
| 168 | * This function is used to enqueue an H.225 message into an outgoing queue for |
| 169 | * the call. |
| 170 | * @param call Pointer to call for which message has to be enqueued. |
| 171 | * @param msg Pointer to the H.225 message to be sent. |
| 172 | * |
| 173 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 174 | */ |
| 175 | EXTERN int ooSendH225Msg(struct OOH323CallData *call, struct Q931Message *msg); |
| 176 | |
| 177 | /** |
| 178 | * This function is used to Send a message on the channel, when channel is |
| 179 | * available for write. |
| 180 | * @param call Pointer to call for which message has to be sent. |
| 181 | * @param type Type of the message. |
| 182 | * |
| 183 | * @return OO_OK, on success. OO_FAILED, on failure. |
| 184 | */ |
| 185 | EXTERN int ooSendMsg(struct OOH323CallData *call, int type); |
| 186 | |
| 187 | /** |
| 188 | * This function is called after a message is sent on the call's channel. |
| 189 | * It can be used to some followup action after message has been sent. |
| 190 | * @param call Pointer to call for which message has been sent. |
| 191 | * @param msgType Type of message |
| 192 | * @param tunneledMsgType If this message is carrying a tunneled message, then |
| 193 | * type of the tunneled message. |
| 194 | * @param associatedChan The channel number associated with the message sent, |
| 195 | * or tunneled message. 0, if no channel is associated. |
| 196 | * |
| 197 | * @return OO_OK, on success. OO_FAILED, on failure |
| 198 | */ |
| 199 | EXTERN int ooOnSendMsg |
| 200 | (struct OOH323CallData *call, int msgType, int tunneledMsgType, |
| 201 | int associatedChan); |
| 202 | |
| 203 | /** |
| 204 | * This function is used to check the status of tcp connection. |
| 205 | * @param call Handle to the call to which connection belongs. |
| 206 | * @param sock Connected socket. |
| 207 | * |
| 208 | * @return True if connection is ok, false otherwise. |
| 209 | */ |
| 210 | EXTERN OOBOOL ooChannelsIsConnectionOK(OOH323CallData *call, OOSOCKET sock); |
| 211 | |
| 212 | /** |
| 213 | * @} |
| 214 | */ |
| 215 | #ifdef __cplusplus |
| 216 | } |
| 217 | #endif |
| 218 | #endif |