00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00024 #ifndef _OOGKCLIENT_H_
00025 #define _OOGKCLIENT_H_
00026
00027 #include "ooasn1.h"
00028 #include "ootypes.h"
00029 #include "H323-MESSAGES.h"
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 #ifndef EXTERN
00036 #ifdef MAKE_DLL
00037 #define EXTERN __declspec(dllexport)
00038 #else
00039 #define EXTERN
00040 #endif
00041 #endif
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define MAX_IP_LEN 15
00051 #define DEFAULT_GKPORT 1719
00052 #define MULTICAST_GKADDRESS "224.0.1.41"
00053 #define MULTICAST_GKPORT 1718
00054 #define DEFAULT_BW_REQUEST 100000
00055
00056
00057 #define DEFAULT_REG_TTL 300
00058 #define DEFAULT_TTL_OFFSET 20
00059 #define DEFAULT_ARQ_TIMEOUT 5
00060 #define DEFAULT_DRQ_TIMEOUT 5
00061 #define DEFAULT_GRQ_TIMEOUT 15
00062 #define DEFAULT_RRQ_TIMEOUT 10
00063
00064
00065 #define OO_MAX_GRQ_RETRIES 3
00066 #define OO_MAX_RRQ_RETRIES 3
00067 #define OO_MAX_ARQ_RETRIES 3
00068
00069
00070 #define OO_GRQ_TIMER (1<<0)
00071 #define OO_RRQ_TIMER (1<<1)
00072 #define OO_REG_TIMER (1<<2)
00073 #define OO_ARQ_TIMER (1<<3)
00074 #define OO_DRQ_TIMER (1<<4)
00075
00081 struct OOH323CallData;
00082 struct ooGkClient;
00083 struct RasCallAdmissionInfo;
00084
00085 typedef struct ooGkClientTimerCb{
00086 int timerType;
00087 struct ooGkClient *pGkClient;
00088 struct RasCallAdmissionInfo *pAdmInfo;
00089 }ooGkClientTimerCb;
00090
00091 enum RasGatekeeperMode {
00092 RasNoGatekeeper = 0,
00093 RasDiscoverGatekeeper = 1,
00094 RasUseSpecificGatekeeper = 2,
00095 };
00096
00097 enum RasCallType{
00098 RasPointToPoint =0,
00099 RasOneToN,
00100 RasnToOne,
00101 RasnToN,
00102 };
00103
00104
00105 enum OOGkClientState {
00106 GkClientIdle = 0,
00107 GkClientDiscovered,
00108 GkClientRegistered,
00109 GkClientUnregistered,
00110 GkClientGkErr,
00111 GkClientFailed
00112 };
00113
00114
00115 typedef struct RasGatekeeperInfo
00116 {
00117 ASN1BOOL willRespondToIRR;
00118 H225UUIEsRequested uuiesRequested;
00119 H225BandWidth bw;
00120 H225RegistrationConfirm_preGrantedARQ preGrantedARQ;
00121 }RasGatekeeperInfo;
00122
00126 typedef struct RasCallAdmissionInfo
00127 {
00128 struct OOH323CallData *call;
00129 unsigned int retries;
00130 unsigned short requestSeqNum;
00131 ASN1USINT irrFrequency;
00132 } RasCallAdmissionInfo;
00133
00134 struct OOAliases;
00135
00144 typedef int (*cb_OnReceivedRegistrationConfirm)
00145 (H225RegistrationConfirm *rcf, struct OOAliases *aliases);
00146
00147
00155 typedef int (*cb_OnReceivedUnregistrationConfirm)
00156 (H225UnregistrationConfirm *ucf, struct OOAliases *aliases);
00157
00164 typedef int (*cb_OnReceivedUnregistrationRequest)
00165 (H225UnregistrationRequest *urq, struct OOAliases *aliases);
00166
00167 typedef struct OOGKCLIENTCALLBACKS{
00168 cb_OnReceivedRegistrationConfirm onReceivedRegistrationConfirm;
00169 cb_OnReceivedUnregistrationConfirm onReceivedUnregistrationConfirm;
00170 cb_OnReceivedUnregistrationRequest onReceivedUnregistrationRequest;
00171 }OOGKCLIENTCALLBACKS;
00172
00178 typedef struct ooGkClient{
00179 ASN1BOOL discoveryComplete;
00180 OOCTXT ctxt;
00181 OOCTXT msgCtxt;
00182 OOSOCKET rasSocket;
00183 int localRASPort;
00184 char localRASIP[20];
00185 char gkRasIP[20];
00186 char gkCallSignallingIP[20];
00187 RasGatekeeperInfo gkInfo;
00188 int gkRasPort;
00189 int gkCallSignallingPort;
00190 unsigned short requestSeqNum;
00191 enum RasGatekeeperMode gkMode;
00192 struct timeval registrationTime;
00193 H225GatekeeperIdentifier gkId;
00194 H225EndpointIdentifier endpointId;
00195 DList callsPendingList;
00196 DList callsAdmittedList;
00197 DList timerList;
00198 OOGKCLIENTCALLBACKS callbacks;
00199 ASN1UINT grqRetries;
00200 ASN1UINT rrqRetries;
00201 ASN1UINT grqTimeout;
00202 ASN1UINT rrqTimeout;
00203 ASN1UINT regTimeout;
00204 ASN1UINT arqTimeout;
00205 ASN1UINT drqTimeout;
00206 enum OOGkClientState state;
00207 } ooGkClient;
00208
00209 struct OOAliases;
00210 struct OOH323CallData;
00211
00223 EXTERN int ooGkClientInit
00224 (enum RasGatekeeperMode eGkMode, char *szGkAddr, int iGkPort );
00225
00231 EXTERN void ooGkClientPrintConfig(ooGkClient *pGkClient);
00232
00239 EXTERN int ooGkClientDestroy(void);
00240
00247 EXTERN int ooGkClientStart(ooGkClient *pGkClient);
00248
00262 EXTERN int ooGkClientSetGkMode(ooGkClient *pGkClient,
00263 enum RasGatekeeperMode eGkMode, char *szGkAddr,
00264 int iGkPort );
00265
00273 EXTERN int ooGkClientCreateChannel(ooGkClient *pGkClient);
00274
00281 EXTERN int ooGkClientCloseChannel(ooGkClient *pGkClient);
00282
00283
00291 EXTERN void ooGkClientRasFillVendor
00292 (ooGkClient *pGkClient, H225VendorIdentifier *psVendor);
00293
00294
00303 EXTERN int ooGkClientReceive(ooGkClient *pGkClient);
00304
00305
00314 EXTERN int ooGkClientHandleRASMessage
00315 (ooGkClient *pGkClient, H225RasMessage *pRasMsg);
00316
00317
00325 EXTERN int ooGkClientSendMsg(ooGkClient *pGkClient, H225RasMessage *pRasMsg);
00326
00327
00335 EXTERN int ooGkClientSendGRQ(ooGkClient *pGkClient);
00336
00337
00345 EXTERN int ooGkClientHandleGatekeeperReject
00346 (ooGkClient *pGkClient, H225GatekeeperReject *pGatekeeperReject);
00347
00355 EXTERN int ooGkClientHandleGatekeeperConfirm
00356 (ooGkClient *pGkClient, H225GatekeeperConfirm *pGatekeeperConfirm);
00357
00358
00368 EXTERN int ooGkClientSendRRQ(ooGkClient *pGkClient, ASN1BOOL keepAlive);
00369
00377 EXTERN int ooGkClientHandleRegistrationConfirm
00378 (ooGkClient *pGkClient, H225RegistrationConfirm *pRegistrationConfirm);
00379
00387 EXTERN int ooGkClientHandleRegistrationReject
00388 (ooGkClient *pGkClient, H225RegistrationReject *pRegistrationReject);
00389
00390
00400 EXTERN int ooGkClientSendURQ(ooGkClient *pGkClient, struct OOAliases *aliases);
00401
00409 EXTERN int ooGkClientHandleUnregistrationRequest
00410 (ooGkClient *pGkClient, H225UnregistrationRequest *punregistrationRequest);
00411
00412
00421 EXTERN int ooGkClientSendUnregistrationConfirm(ooGkClient *pGkClient,
00422 unsigned reqNo);
00423
00433 EXTERN int ooGkClientSendAdmissionRequest
00434 (ooGkClient *pGkClient, struct OOH323CallData *call, ASN1BOOL retransmit);
00435
00443 EXTERN int ooGkClientHandleAdmissionConfirm
00444 (ooGkClient *pGkClient, H225AdmissionConfirm *pAdmissionConfirm);
00445
00446
00456 EXTERN int ooGkClientHandleAdmissionReject
00457 (ooGkClient *pGkClient, H225AdmissionReject *pAdmissionReject);
00458
00466 EXTERN int ooGkClientSendDisengageRequest
00467 (ooGkClient *pGkClient, struct OOH323CallData *call);
00468
00476 EXTERN int ooGkClientHandleDisengageConfirm
00477 (ooGkClient *pGkClient, H225DisengageConfirm *pDCF);
00478
00485 EXTERN int ooGkClientRRQTimerExpired(void*pdata);
00486
00493 EXTERN int ooGkClientGRQTimerExpired(void* pdata);
00494
00501 EXTERN int ooGkClientREGTimerExpired(void *pdata);
00502
00509 EXTERN int ooGkClientARQTimerExpired(void* pdata);
00510
00518 EXTERN int ooGkClientCleanCall(ooGkClient *pGkClient, struct OOH323CallData *call);
00519
00527 EXTERN int ooGkClientHandleClientOrGkFailure(ooGkClient *pGkClient);
00528
00538 EXTERN int ooGkClientUpdateRegisteredAliases
00539 (ooGkClient *pGkClient, H225_SeqOfH225AliasAddress *pAddresses,
00540 OOBOOL registered);
00541
00550 int ooGkClientSetCallbacks
00551 (ooGkClient *pGkClient, OOGKCLIENTCALLBACKS callbacks);
00556 #ifdef __cplusplus
00557 }
00558 #endif
00559
00560 #endif