⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lid.h

📁 radius协议源码÷The Radius Stack will connect to a Radius Server. This stack implementation is built upo
💻 H
📖 第 1 页 / 共 2 页
字号:
    virtual char ReadDTMF(      unsigned line   /// Number of line    );    /**Get DTMF removal mode.       When set in this mode the DTMF tones detected are removed from the       encoded data stream as returned by ReadFrame().      */    virtual BOOL GetRemoveDTMF(      unsigned line   /// Number of line    );    /**Set DTMF removal mode.       When set in this mode the DTMF tones detected are removed from the       encoded data stream as returned by ReadFrame().      */    virtual BOOL SetRemoveDTMF(      unsigned line,     /// Number of line      BOOL removeTones   /// Flag for removing DTMF tones.    );    enum CallProgressTones {      DialTone,   // Dial tone      RingTone,   // Ring indication tone      BusyTone,   // Line engaged tone      ClearTone,  // Call failed/cleared tone (often same as busy tone)      NumTones    };    /**See if a tone is detected.      */    virtual CallProgressTones IsToneDetected(      unsigned line   /// Number of line    );    /**See if a tone is detected.      */    virtual CallProgressTones WaitForToneDetect(      unsigned line,          /// Number of line      unsigned timeout = 3000 /// Milliseconds to wait for    );    /**See if a tone is detected.      */    virtual BOOL WaitForTone(      unsigned line,          /// Number of line      CallProgressTones tone, /// Tone to wait for      unsigned timeout = 3000 /// Milliseconds to wait for    );    /**Play a tone.      */    virtual BOOL PlayTone(      unsigned line,          /// Number of line      CallProgressTones tone  /// Tone to be played    );    /**Determine if a tone is still playing      */    BOOL IsTonePlaying(      unsigned line   /// Number of line    );    /**Stop playing a tone.      */    virtual BOOL StopTone(      unsigned line   /// Number of line    );    /**Dial a number on network line.       The takes the line off hook, waits for dial tone, and transmits the       specified number as DTMF tones.       If the requireTones flag is TRUE the call is aborted of the call       progress tones are not detected. Otherwise the call proceeds with short       delays while it tries to detect the call progress tones.       The return code indicates the following:          DialTone  No dial tone detected          RingTone  Dial was successful          BusyTone  The remote phone was busy          ClearTone Dial failed (usually means rang out)          NumTones  There was an internal error making the call      */    virtual CallProgressTones DialOut(      unsigned line,                /// Number of line      const PString & number,       /// Number to dial      BOOL requireTones = FALSE     /// Require dial/ring tone to be detected    );    enum T35CountryCodes {      Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,      Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,      Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,      Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory,       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,      Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,      CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,      CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,      DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,      Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,      FalklandIslands, Fiji, Finland, France, FrenchPolynesia,      FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,      Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,      Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,      Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,      Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,      Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,      Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,      Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,      Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,      Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,      Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,      SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,      SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,      SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,      Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,      Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,      Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,      UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,      USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,      WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,      NumCountryCodes,      UnknownCountry = -1    };    /**Get the country code set for the device.      */    T35CountryCodes GetCountryCode() const { return countryCode; }    /**Get the country code set for the device as a string.      */    PString GetCountryCodeName() const;    /**Set the country code set for the device.       This may change the line analogue coefficients, ring detect, call       disconnect detect and call progress tones to fit the countries       telephone network.      */    virtual BOOL SetCountryCode(      T35CountryCodes country   /// COuntry code for device    );    /**Set the country code set for the device.      */    virtual BOOL SetCountryCode(      const PString & countryName   /// COuntry code for device    );    /**Return number for last error.      */    int GetErrorNumber() const { return osError; }    /**Return text for last error.      */    PString GetErrorText() const;    virtual void PrintOn(      ostream & strm    ) const;  protected:    int os_handle;    int osError;    T35CountryCodes countryCode;#if PTRACING    static const char * const CallProgressTonesNames[NumTones];    friend ostream & operator<<(ostream & o, CallProgressTones t) { return o << CallProgressTonesNames[t]; }#endif};/**This class describes an I/O channel that uses a Line Interface Device. */class OpalLineChannel : public PChannel{  PCLASSINFO(OpalLineChannel, PChannel);  public:    /**Create a new channel to a line interface device.      */    OpalLineChannel(      OpalLineInterfaceDevice & device, /// Device for channel I/O      unsigned line,                    /// Number of line      BOOL reading                      /// Channel is reading/writing    );    ~OpalLineChannel();    /**Get the device name.      */    PString GetName() const;    /**Close the channel.      */    BOOL Close();    /** Low level read from the channel. This function may block until the       requested number of characters were read or the read timeout was       reached. The GetLastReadCount() function returns the actual number       of bytes read.       The GetErrorCode() function should be consulted after Read() returns       FALSE to determine what caused the failure.       @return       TRUE indicates that at least one character was read from the channel.       FALSE means no bytes were read due to timeout or some other I/O error.     */    virtual BOOL Read(      void * buf,   /// Pointer to a block of memory to receive the read bytes.      PINDEX len    /// Maximum number of bytes to read into the buffer.    );    /** Low level write to the channel. This function will block until the       requested number of characters are written or the write timeout is       reached. The GetLastWriteCount() function returns the actual number       of bytes written.       The GetErrorCode() function should be consulted after Write() returns       FALSE to determine what caused the failure.       @return       TRUE if at least len bytes were written to the channel.     */    virtual BOOL Write(      const void * buf, /// Pointer to a block of memory to write.      PINDEX len        /// Number of bytes to write.    );    /**Get the device the channel is writing to.      */    OpalLineInterfaceDevice & GetDevice() const { return device; }    /**Set the codec to be used on the next read/write.      */    BOOL SetCodec(      RTP_DataFrame::PayloadTypes codec  /// Codec type for channel    );  protected:    BOOL ReadFrame(BYTE * buffer);    BOOL WriteFrame(const BYTE * buffer);    OpalLineInterfaceDevice &   device;    unsigned                    lineNumber;    BOOL                        reading;    RTP_DataFrame::PayloadTypes codec;    PBYTEArray                  deblockingBuffer;    PINDEX                      deblockingOffset;};/**This class describes the LID based codec capability. */class H323_LIDCapability : public H323AudioCapability{  PCLASSINFO(H323_LIDCapability, H323AudioCapability);  public:  /**@name Construction */  //@{    /**Create a new capability.     */    H323_LIDCapability(      RTP_DataFrame::PayloadTypes rtpType /// RTP codec type for capability    );  //@}  /**@name Overrides from class PObject */  //@{    /**Create a copy of the object.      */    virtual PObject * Clone() const;    /**Get the name of the media data format this class represents.     */    virtual PString GetFormatName() const;  //@}  /**@name Identification functions */  //@{    /**Get the sub-type of the capability. This is a code dependent on the       main type of the capability.       This returns H245_AudioCapability::e_nonStandard.     */    virtual unsigned GetSubType() const;  //@}  /**@name Operations */  //@{    /**Create the codec instance, allocating resources as required.     */    virtual H323Codec * CreateCodec(      H323Codec::Direction direction  /// Direction in which this instance runs    ) const;    /**Determine if the codec specified for the object is valid.      */    BOOL IsValid() const;    /**Add all of the capabilities that a LID is capable of.     */    static void AddAllCapabilities(      const OpalLineInterfaceDevice & device, /// Device to get codecs from      H323Capabilities & capabilities,        /// Table to add capabilities to      PINDEX descriptorNum,   /// The member of the capabilityDescriptor to add      PINDEX simultaneous     /// The member of the SimultaneousCapabilitySet to add    );  //@}  /**@name Protocol manipulation */  //@{    /**This function is called whenever and outgoing TerminalCapabilitySet       or OpenLogicalChannel PDU is being constructed for the control channel.       It allows the capability to set the PDU fields from information in       members specific to the class.       The default behaviour sets the data rate field in the PDU.     */    virtual BOOL OnSendingPDU(      H245_AudioCapability & pdu,  /// PDU to set information on      unsigned packetSize          /// Packet size to use in capability    ) const;    /**This function is called whenever and incoming TerminalCapabilitySet       or OpenLogicalChannel PDU has been used to construct the control       channel. It allows the capability to set from the PDU fields,       information in members specific to the class.       The default behaviour gets the data rate field from the PDU.     */    virtual BOOL OnReceivedPDU(      const H245_AudioCapability & pdu,  /// PDU to get information from      unsigned & packetSize              /// Packet size to use in capability    );  //@}  protected:    PINDEX codecTableIndex;};/**This class is a LID codec that only converts data for playback on some   other audio device. */class H323_LIDCodec : public H323AudioCodec{  PCLASSINFO(H323_LIDCodec, H323AudioCodec);  public:    /**Create a new LID based codec.     */    H323_LIDCodec(      Direction direction,        /// Direction in which this instance runs      unsigned numFrames,         /// Number of frames to transmit in packet      unsigned codecTableIndex    /// Type of codec to use    );    /**Open the codec.       This will open the codec for encoding or decoding, it is called after       the logical channel have been established and the background threads to       drive them have been started. This is primarily used to delay allocation       of resources until the last millisecond.      */    virtual BOOL Open(      H323Connection & connection /// Connection between the endpoints    );    /**Encode the data from the appropriate device.       This will encode a frame of data for transmission. The exact size and       description of the data placed in the buffer is codec dependent but       should be less than H323Capability::GetTxFramesInPacket() *       H323Capability::GetMaxFrameSize() in length.       The length parameter is filled with the actual length of the encoded       data, often this will be the same as the size parameter.       This function is called every GetFrameRate() timestamp units, so MUST       take less than (or equal to) that amount of time to complete!       Note that a returned length of zero indicates that time has passed but       there is no data encoded. This is typically used for silence detection       in an audio codec.     */    virtual BOOL Read(      BYTE * buffer,            /// Buffer of encoded data      unsigned & length,        /// Actual length of encoded data buffer      RTP_DataFrame & rtpFrame  /// RTP data frame    );    /**Decode the data and output it to appropriate device.       This will decode a single frame of received data. The exact size and       description of the data required in the buffer is codec dependent but       should be less than H323Capability::GetRxFramesInPacket() *       H323Capability::GetMaxFrameSize()  in length.       It is expected this function anunciates the data. That is, for example       with audio data, the sound is output on a speaker.       This function is called every GetFrameRate() timestamp units, so MUST       take less than that amount of time to complete!     */    virtual BOOL Write(      const BYTE * buffer,          /// Buffer of encoded data      unsigned length,              /// Length of encoded data buffer      const RTP_DataFrame & frame,  /// Entire RTP frame      unsigned & written            /// Number of bytes used from data buffer    );    /**Get the bandwidth used by the channel in 100's of bits/sec.       The default behaviour calculates the bandwidth used from the       bytesPerFrame and frame rate parameters.     */    virtual unsigned GetBandwidth() const;    /**Calculate the energy in the audio stream.       This is called from within DetectSilence() to calculate the average       energy since the last call to DetectSilence().      */    virtual unsigned GetAverageSignalLevel();  protected:    unsigned codecTableIndex;    unsigned packetSize;};#endif // __LID_H// End of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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