h225ras.h
资源名称:h323.zip [点击查看]
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:7k
源码类别:
IP电话/视频会议
开发平台:
WINDOWS
- /*
- * $Revision: 1.7 $
- * $Date: 1998/10/05 21:13:55 $
- */
- ////////////////////////////////////////////////////////////////
- // Copyright (c) 1996,97 Lucent Technologies //
- // All Rights Reserved //
- // //
- // THIS IS UNPUBLISHED //
- // PROPRIETARY SOURCE //
- // CODE OF Lucent Technologies //
- // //
- // The copyright notice above does not evidence any //
- // actual or intended publication of such source code//
- ////////////////////////////////////////////////////////////////
- //
- ////////////////////////////////////////////////////////////////
- // File : h225ras.h //
- // //
- // This file declares the H225RASProtocol class. //
- // //
- // History: //
- // //
- // Mar_25_1997 Created //
- // Oct_17_1997 Added private member h225_version[] //
- // Nov_04_1997 Changed the NotifyRASMessage prototype to //
- // include the source of the message //
- // Mar_09_1998 Changed the NotifyRASMessage prototype to //
- // include the destination of the message. //
- // Mar_19_1998 Retries/Timers //
- // May_13_1998 Added overloaded GetProtocolID method, //
- // version is now a unsigned long array. //
- // //
- ////////////////////////////////////////////////////////////////
- #if (!defined(__H225RAS_H__))
- #define __H225RAS_H__
- #include "util/platform.h"
- #include "api/apierr.h"
- #include "api/h225raserr.h"
- #include "api/h225rastypes.h"
- enum H225RASClientType
- {
- CLT_GATEKEEPER,
- CLT_TERMINAL,
- CLT_BOTH
- };
- // Forward declarations
- class Trans;
- class RASTransClient;
- class Logger;
- class SearchableStore;
- class MessageTransmitter;
- struct DLLEXPORT H225RASTransmitterInfo
- {
- int nretries; // Number of retries made.
- int timeout; // Time(milliseconds) interval between retries.
- int round_trip_time; // Total time elapsed between the first transmit
- // and the first response.
- int nrips; // Number of RIP messages received.
- };
- class DLLEXPORT H225RASProtocol
- {
- public:
- // ras_endpoint:
- // This takes values from the enum H225RASClientType,
- // if ras_endpoint is CT_BOTH or CT_GATEKEEPER then
- // this object listens for RAS messages on UDP port
- // 1719.
- H225RASProtocol(H225CSEndpointType& endpoint_type,
- H225CSVendorID& vendor_id, int ras_endpoint,
- ProtReturnCode& result);
- H225RASProtocol(H225CSEndpointType& endpoint_type,
- H225CSVendorID& vendor_id, int ras_endpoint,
- sockaddr* ras_addr, sockaddr* mcast_addr,
- ProtReturnCode& result);
- virtual ~H225RASProtocol();
- // Method to get protocolid, this basically contains
- // information on the H225 version number etc..
- ProtReturnCode GetProtocolID(unsigned char*& buf, int& length);
- ProtReturnCode GetProtocolID(int &version);
- ProtReturnCode GetEndpointType(H225CSEndpointType&);
- ProtReturnCode GetVendorID(H225CSVendorID&);
- // This call enables a terminal to choose the local port
- // for receiving RAS messages.
- ProtReturnCode SetLocalAddr(sockaddr* ras_addr);
- // The call to establish a gatekeeper to work with.
- // Note that all further RAS messages, would be sent to
- // the gatekeeper specified in gatekeeper_address.
- ProtReturnCode ChooseGK(sockaddr* gk_addr);
- // Functions to send out RAS messages.
- // For all Send functions the (optional) first parameter,
- // specifies the gatekeeper to which the message would be sent.
- // Terminals may set this address once by using the ChooseGatekeeper
- // function.
- ProtReturnCode SendRASMessage(sockaddr* dst_addr,
- H225RASMessage& ras_message);
- // SendRASMessage variant with timeout and retries..
- // timeout is in milliseconds and retries is the number of
- // retries to perform.
- // A value of 0 for timeout or retries will cause the
- //stack to use an internal default.
- ProtReturnCode SendRASMessage(sockaddr* dst_addr,
- H225RASMessage& ras_message, int timeout, int retries);
- // Callback for notification of RAS messages arriving on our
- // network interface.
- // origin specifies the sender of this ras message, and
- // destination specifies the address to which the message
- // was sent. This is to be used in scenarios where a GRQ
- // is unicast to the RAS channel, or when there are multiple
- // interface cards.
- virtual void NotifyRASMessage(H225RASMessage& ras_message,
- struct sockaddr *origin, struct sockaddr *destination,
- struct H225RASTransmitterInfo& info) = 0;
- //
- // This method is invoked when H225RASProtcol times out
- // trying to send a XXQ (like GRQ, RRQ) or IRR message out.
- // For more information see the section 7.19
- // ("RAS Timers and Request in Progress (RIP)") of H225.0 V2
- //
- // ntries: no of attempts made.
- // timeout: Timeout(ms) value used in each try.
- virtual void NotifyRASTimeout(H225RASMessage& ras_message,
- struct sockaddr *destination,
- H225RASTransmitterInfo& info) = 0;
- private:
- friend class RASTransClient;
- friend class MessageTransmitter;
- // Type of the endpoint using this object..
- int endpoint_type;
- // The gatekeepers transport address, used only by terminals.
- // All ras messages from terminals will go to this address.
- sockaddr* gk_addr;
- // The well known multicast address to send gatekeeper discovery
- // messages to.
- sockaddr* multicast_addr;
- // The local address on which ras messages will be received.
- // For Gatekeepers, this will be fixed to UDP port 1719
- sockaddr* local_ras_addr;
- // address of the endpoint that originated the message that
- // is currently being processed. This field is only valid
- // during the lifetime of the TransNotifyPacketArrived callback..
- sockaddr* originator_address;
- // Trans handles...
- int multicast_channel;
- int ras_channel;
- int multicast_llc;
- int ras_llc;
- int trans_client_handle;
- Trans *trans;
- RASTransClient* ras_trans_client;
- SearchableStore *retry_list;
- H225CSEndpointType endpoint;
- H225CSVendorID vendor;
- unsigned long h225_version[6];
- private:
- void Initialize(H225CSEndpointType& endpoint,
- H225CSVendorID& vendor_id, int ras_endpoint,
- ProtReturnCode& result);
- ProtReturnCode CreateMulticastChannel();
- ProtReturnCode CreateRASChannel();
- void DestroyMulticastChannel();
- void DestroyRASChannel();
- ProtReturnCode SendMessage(sockaddr* dst, char* msg,
- int length);
- ProtReturnCode LockedSendMessage(sockaddr* dst, char* msg,
- int length);
- Logger* _logger;
- };
- #endif // __H225RAS_H__