oogkclient.h

来自「一个非常美妙的proxy。功能强大。基于sip的协议。如果还要的话」· C头文件 代码 · 共 561 行 · 第 1/2 页

H
561
字号
/* * Copyright (C) 2005 by Page Iberica, S.A. * Copyright (C) 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 ooGkClient.h  * This file contains functions to support RAS protocol.  * * */#ifndef _OOGKCLIENT_H_#define _OOGKCLIENT_H_#include "ooasn1.h"#include "ootypes.h"#include "H323-MESSAGES.h"#ifdef __cplusplusextern "C" {#endif#ifndef EXTERN#ifdef MAKE_DLL#define EXTERN __declspec(dllexport)#else#define EXTERN#endif /* _WIN32 */#endif /* EXTERN *//*-------------------------------------------------------------------*//*  Public definitions                                               *//*-------------------------------------------------------------------*/#define MAX_IP_LEN 15#define DEFAULT_GKPORT 1719#define MULTICAST_GKADDRESS "224.0.1.41"#define MULTICAST_GKPORT 1718#define DEFAULT_BW_REQUEST  100000/* Various timeouts in seconds */#define DEFAULT_REG_TTL 300#define DEFAULT_TTL_OFFSET 20#define DEFAULT_ARQ_TIMEOUT 5#define DEFAULT_DRQ_TIMEOUT 5#define DEFAULT_GRQ_TIMEOUT 15#define DEFAULT_RRQ_TIMEOUT 10/* Number of retries before giving up */#define OO_MAX_GRQ_RETRIES 3#define OO_MAX_RRQ_RETRIES 3#define OO_MAX_ARQ_RETRIES 3/* Gk Client timers */#define OO_GRQ_TIMER (1<<0)#define OO_RRQ_TIMER (1<<1)#define OO_REG_TIMER (1<<2)#define OO_ARQ_TIMER (1<<3)#define OO_DRQ_TIMER (1<<4)/**  * @defgroup gkclient Gatekeeper client * @{ */struct OOH323CallData;struct ooGkClient;struct RasCallAdmissionInfo;typedef struct ooGkClientTimerCb{   int timerType;   struct ooGkClient *pGkClient;   struct RasCallAdmissionInfo *pAdmInfo;}ooGkClientTimerCb;enum RasGatekeeperMode {   RasNoGatekeeper = 0,   RasDiscoverGatekeeper = 1,   RasUseSpecificGatekeeper = 2,};enum RasCallType{   RasPointToPoint =0,   RasOneToN,   RasnToOne,   RasnToN,};enum OOGkClientState {   GkClientIdle = 0,   GkClientDiscovered, /* Gk Discovery is complete */   GkClientRegistered, /* registered with gk */   GkClientUnregistered,   GkClientGkErr,/*Gk is not responding, in discover mode can look for new GK*/   GkClientFailed};   typedef struct RasGatekeeperInfo{   ASN1BOOL willRespondToIRR;   H225UUIEsRequested uuiesRequested;   H225BandWidth bw;   H225RegistrationConfirm_preGrantedARQ preGrantedARQ;}RasGatekeeperInfo;/** *  Call Admission Information */typedef struct RasCallAdmissionInfo{   struct OOH323CallData *call;   unsigned int retries;   unsigned short requestSeqNum;   ASN1USINT irrFrequency;} RasCallAdmissionInfo;struct OOAliases;/** * NOTE- This functionality is not yet fully completed. * This is a callback function which is triggered when registration confirm  * message is received from the gatekeeper. The first parameter is the message * received. The second parameter provides updated list of aliases after the  * message was processed by the stack. * @param rcf  Handle to the received registration confirm message */typedef int (*cb_OnReceivedRegistrationConfirm)     (H225RegistrationConfirm *rcf, struct OOAliases *aliases);/** * NOTE- This functionality is not yet fully completed. * This is a callback function which is triggered when unregistration confirm  * message is received. The first parameter is the message received. The second * parameter provides updated list of aliases after the message was processed  * by the stack. */typedef int (*cb_OnReceivedUnregistrationConfirm)     (H225UnregistrationConfirm *ucf, struct OOAliases *aliases);/** * NOTE- This functionality is not yet fully completed. * This is a callback function which is triggered when unregistration request  * message is received. The first parameter is the message received. The second * parameter provides the list of aliases requested to be unregistered. */typedef int (*cb_OnReceivedUnregistrationRequest)     (H225UnregistrationRequest *urq, struct OOAliases *aliases);typedef struct OOGKCLIENTCALLBACKS{   cb_OnReceivedRegistrationConfirm onReceivedRegistrationConfirm;   cb_OnReceivedUnregistrationConfirm onReceivedUnregistrationConfirm;   cb_OnReceivedUnregistrationRequest onReceivedUnregistrationRequest;}OOGKCLIENTCALLBACKS;/** * Structure to store all the configuration information for the gatekeeper * client. Gatekeeper client is responsible for all the communication with * a gatekeeper. */typedef struct ooGkClient{   ASN1BOOL discoveryComplete;   OOCTXT ctxt;   OOCTXT msgCtxt;   OOSOCKET rasSocket;   int localRASPort;   char localRASIP[20];   char gkRasIP[20];   char gkCallSignallingIP[20];   RasGatekeeperInfo gkInfo;   int gkRasPort;   int gkCallSignallingPort;   unsigned short requestSeqNum;   enum RasGatekeeperMode gkMode; /* Current Gk mode */   struct timeval registrationTime;   H225GatekeeperIdentifier gkId;   H225EndpointIdentifier endpointId;   DList callsPendingList;   DList callsAdmittedList;   DList timerList;   OOGKCLIENTCALLBACKS callbacks;   ASN1UINT grqRetries;   ASN1UINT rrqRetries;   ASN1UINT grqTimeout;   ASN1UINT rrqTimeout;   ASN1UINT regTimeout;   ASN1UINT arqTimeout;   ASN1UINT drqTimeout;   enum OOGkClientState  state;} ooGkClient;struct OOAliases;struct OOH323CallData;/** * This function is used to initialize the Gatekeeper client.If an application * wants to use gatekeeper services, it should call this function immediately * after initializing the H323 EndPoint. * @param eGkMode          Gatekeeper mode. * @param szGkAddr         Dotted gk ip address, if gk has to be specified. * @param iGkPort          Gk port. * * @return                 OO_OK, on success. OO_FAILED, on failure. *  */EXTERN int ooGkClientInit   (enum RasGatekeeperMode eGkMode, char *szGkAddr, int iGkPort );/** * This function is used to print the gatekeeper client configuration  * information to log. * @param pGkClient        Handle to gatekeeper client. */EXTERN void ooGkClientPrintConfig(ooGkClient *pGkClient);/** * This function is used to destroy Gatekeeper client. It releases all the  * associated memory. * * @return     OO_OK, on success. OO_FAILED, on failure. */EXTERN int ooGkClientDestroy(void);/** * This function is used to start the Gatekeeper client functionality. * @param pGkClient        Pointer to the Gatekeeper Client. *  * @return                 OO_OK, on success. OO_FAILED, on failure. */EXTERN int ooGkClientStart(ooGkClient *pGkClient);/** * This function is invoked to set a gatekeeper mode.  * @param pGkClient Handle to gatekeeper client.  * @param eGkMode   Gatekeeper mode selected. One of the following:  *                    - RasNoGatekeeper (DEFAULT), No Gatekeeper.               *                    - RasDiscoverGatekeeper, to discover a gatekeeper  *                      automatically.					        *                    - RasUseSpecificGatekeeper, to use a specific gatekeeper. * @param szGkAddr  Gatekeeper address (only when using specific gatekeeper). * @param iGkPort   Gatekeeper RAS port * * @return         Completion status - OO_OK on success, OO_FAILED on failure */EXTERN int ooGkClientSetGkMode(ooGkClient *pGkClient,                                enum RasGatekeeperMode eGkMode, char *szGkAddr,                                int iGkPort );/** * This function is used to create a RAS channel for the gatekeeper. * @param pGkClient     Pointer to the Gatekeeper client for which RAS channel *                      has to be created. * * @return              OO_OK, on success. OO_FAILED, on failure. */EXTERN int ooGkClientCreateChannel(ooGkClient *pGkClient);/** * This function is used to close a RAS channel of the gatekeeper client. * @param pGkClient    Pointer to the gatekeeper client. * * @return             OO_OK, on success. OO_FAILED, on failure. */EXTERN int ooGkClientCloseChannel(ooGkClient *pGkClient);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?