aboutsummaryrefslogtreecommitdiffstats
path: root/addons/ooh323c/src/ooLogChan.h
blob: f480f109084ee888bf3822a43ef5ccd5aeb26d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
 * Copyright (C) 2004-2005 by Objective Systems, Inc.
 *
 * This software is furnished under an open source license and may be 
 * used and copied only in accordance with the terms of this license. 
 * The text of the license may generally be found in the root 
 * directory of this installation in the COPYING file.  It 
 * can also be viewed online at the following URL:
 *
 *   http://www.obj-sys.com/open/license.html
 *
 * Any redistributions of this file including modified versions must 
 * maintain this copyright notice.
 *
 *****************************************************************************/
/**
 * @file ooLogChan.h 
 * This file contains structures and functions for maintaining information
 * on logical channels within the stack.
 */
#ifndef _OOLOGCHAN_H_
#define _OOLOGCHAN_H_

#include "ootypes.h"
#include "ooCapability.h"
#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup logchan H.245 logical channel management
 * @{
 */
struct ooH323EpCapability;
struct OOH323CallData;

/** 
 * Logical channel states.
 */
typedef enum {
   OO_LOGICAL_CHAN_UNKNOWN, 
   OO_LOGICALCHAN_IDLE, 
   OO_LOGICALCHAN_PROPOSED, 
   OO_LOGICALCHAN_ESTABLISHED,
   OO_LOGICALCHAN_PROPOSEDFS
} OOLogicalChannelState;

/**
 * Structure to store information on logical channels for a call.
 */
typedef struct OOLogicalChannel {
   int  channelNo;
   int  sessionID;
   enum OOCapType type;
   char dir[10];  /* receive/transmit */
   char remoteIP[20];
   int  remoteMediaPort;
   int  remoteMediaControlPort;
   int  localRtpPort;
   int  localRtcpPort;
   char localIP[20];
   OOLogicalChannelState state;         
   struct ooH323EpCapability *chanCap;
   struct OOLogicalChannel *next;
} OOLogicalChannel;

#define ooLogicalChannel OOLogicalChannel

/**
 * This function is used to add a new logical channel entry into the list
 * of currently active logical channels.
 * @param call      Pointer to the call for which new logical channel 
 *                  entry has to be created.
 * @param channelNo Channel number for the new channel entry.
 * @param sessionID Session identifier for the new channel.
 * @param dir       Direction of the channel(transmit/receive)
 * @param epCap     Capability to be used for the new channel.
 *
 * @return          Pointer to logical channel, on success. NULL, on failure
 */
EXTERN ooLogicalChannel* ooAddNewLogicalChannel
   (struct OOH323CallData *call, int channelNo, int sessionID, 
    char *dir, ooH323EpCapability *epCap);

/**
 * This function is used to find a logical channel using the logical 
 * channel number as a key.
 * @param call          Pointer to the call for which logical channel is 
 *                      required.
 * @param channelNo     Forward Logical Channel number for the logical channel
 *
 * @return              Pointer to the logical channel if found, NULL 
 *                      otherwise.   
 */
EXTERN ooLogicalChannel* ooFindLogicalChannelByLogicalChannelNo
(struct OOH323CallData *call, int channelNo);

/**
 * This function is called when a new logical channel is established. It is 
 * particularly useful in case of faststart. When the remote endpoint selects 
 * one of the proposed alternatives, other channels for the same session type 
 * need to be closed. This function is used for that.
 *
 * @param call      Handle to the call which owns the logical channel.
 * @param pChannel  Handle to the newly established logical channel.
 * @return          OO_OK, on success. OO_FAILED, on failure.
 */
EXTERN int ooOnLogicalChannelEstablished
(struct OOH323CallData *call, OOLogicalChannel * pChannel);

/**
 * This function is used to retrieve a logical channel with a particular 
 * sessionID. Note that there can be two entries of logical channel, one in 
 * each direction. This function will return the first channel which has the 
 * same session ID.
 * @param call      Handle to the call which owns the channels to be searched.
 * @param sessionID Session id of the session which is to be searched for.
 * @param dir       Direction of the channel.(transmit/receive)
 *
 * @return          Returns a pointer to the logical channel if found, NULL 
 *                  otherwise.
 */
EXTERN ooLogicalChannel* ooGetLogicalChannel
(struct OOH323CallData *call, int sessionID, char *dir);

/**
 * This function is used to remove a logical channel from the list of 
 * channels within the call structure.
 * @param call              Pointer to the call from which logical channel has 
 *                          to be removed.
 * @param ChannelNo         Forward logical channel number of the channel to be
 *                          removed.
 * @return          OO_OK, on success. OO_FAILED, on failure.
 */
EXTERN int ooRemoveLogicalChannel (struct OOH323CallData *call, int ChannelNo);

/**
 * This function is used to cleanup a logical channel. It first stops media if
 * it is still active and then removes the channel from the list, freeing up 
 * all the associated memory.
 * @param call       Handle to the call which owns the logical channel.
 * @param channelNo  Channel number identifying the channel.
 *
 * @return           OO_OK, on success. OO_FAILED, on failure.
 */
EXTERN int ooClearLogicalChannel (struct OOH323CallData *call, int channelNo);

/**
 * This function is used to cleanup all the logical channels associated with 
 * the call.
 * @param call      Handle to the call which owns the channels.
 *
 * @return          OO_OK, on success. OO_FAILED, on failure.
 */
EXTERN int ooClearAllLogicalChannels (struct OOH323CallData *call);

/**
 * This function is used to find a logical channel from a received
 * H.245 Open Logical Channel (OLC) message.
 * @param call     Handle to the related call.
 * @param olc      Handle to the received OLC.
 *
 * @return         Returns the corresponding logical channel if found,
 *                 else returns NULL.
 */
EXTERN OOLogicalChannel * ooFindLogicalChannelByOLC
(struct OOH323CallData *call, H245OpenLogicalChannel *olc);

/**
 * This function is used to find a logical channel based on session Id,
 * direction of channel and datatype.
 * @param call       Handle to the call
 * @param sessionID  Session ID for the channel to be searched.
 * @param dir        Direction of the channel wrt local endpoint.
 *                   (transmit/receive)
 * @param dataType   Handle to the data type for the channel.
 *
 * @return           Logical channel, if found, NULL otherwise.
 */
EXTERN OOLogicalChannel * ooFindLogicalChannel
(struct OOH323CallData* call, int sessionID, char *dir, H245DataType* dataType);

EXTERN OOLogicalChannel* ooGetTransmitLogicalChannel(struct OOH323CallData *call);

/** 
 * @} 
 */

#ifdef __cplusplus
}
#endif

#endif