# transaddr.h

Go to the documentation of this file.

    00001 /*
    00002  * transport.h
    00003  *
    00004  * H.323 protocol handler
    00005  *
    00006  * Open H323 Library
    00007  *
    00008  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
    00009  *
    00010  * The contents of this file are subject to the Mozilla Public License
    00011  * Version 1.0 (the "License"); you may not use this file except in
    00012  * compliance with the License. You may obtain a copy of the License at
    00013  * http://www.mozilla.org/MPL/
    00014  *
    00015  * Software distributed under the License is distributed on an "AS IS"
    00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00017  * the License for the specific language governing rights and limitations
    00018  * under the License.
    00019  *
    00020  * The Original Code is Open H323 Library.
    00021  *
    00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
    00023  *
    00024  * Portions of this code were written with the assisance of funding from
    00025  * Vovida Networks, Inc. http://www.vovida.com.
    00026  *
    00027  * Contributor(s): ______________________________________.
    00028  *
    00029  * $Revision: 25568 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2011-04-14 05:04:08 -0500 (Thu, 14 Apr 2011) $
    00032  */
    00033
    00034 #ifndef OPAL_H323_TRANSADDR_H
    00035 #define OPAL_H323_TRANSADDR_H
    00036
    00037 #ifdef P_USE_PRAGMA
    00038 #pragma interface
    00039 #endif
    00040
    00041 #include <opal/buildopts.h>
    00042
    00043 #if OPAL_H323
    00044
    00045 #include <ptlib/sockets.h>
    00046 #include <opal/transports.h>
    00047
    00048
    00049 class H225_TransportAddress;
    00050 class H245_TransportAddress;
    00051 class H225_ArrayOf_TransportAddress;
    00052
    00053
    00054 typedef OpalListener  H323Listener;
    00055 typedef PList<H323Listener> H323ListenerList;
    00056 typedef OpalTransport H323Transport;
    00057 typedef OpalTransportUDP H323TransportUDP;
    00058
    00059
    00061
    00066 class H323TransportAddress : public OpalTransportAddress
    00067 {
    00068     PCLASSINFO(H323TransportAddress, OpalTransportAddress);
    00069   public:
    00070     H323TransportAddress()
    00071       { }
    00072     H323TransportAddress(const char * addr, WORD port = 0, const char * proto = NULL)
    00073       : OpalTransportAddress(addr, port, proto) { }
    00074     H323TransportAddress(const PString & addr, WORD port = 0, const char * proto = NULL)
    00075       : OpalTransportAddress(addr, port, proto) { }
    00076     H323TransportAddress(const OpalTransportAddress & addr)
    00077       : OpalTransportAddress(addr) { }
    00078     H323TransportAddress(PIPSocket::Address ip, WORD port, const char * proto = NULL)
    00079       : OpalTransportAddress(ip, port, proto) { }
    00080
    00081     H323TransportAddress(
    00082       const H225_TransportAddress & pdu,
    00083       const char * proto = NULL
    00084     );
    00085     H323TransportAddress(
    00086       const H245_TransportAddress & pdu,
    00087       const char * proto = NULL
    00088     );
    00089
    00090     PBoolean SetPDU(H225_TransportAddress & pdu, WORD defPort = 0) const;
    00091     PBoolean SetPDU(H245_TransportAddress & pdu, WORD defPort = 0) const;
    00092 };
    00093
    00094
    00095 class H323TransportAddressArray : public PArray<H323TransportAddress>
    00096 {
    00097     typedef PArray<H323TransportAddress> ParentClass;
    00098     PCLASSINFO(H323TransportAddressArray, ParentClass);
    00099
    00100   protected:
    00101     inline H323TransportAddressArray(int dummy, const H323TransportAddressArray * c)
    00102       : ParentClass(dummy, c) { }
    00103
    00104   public:
    00105     H323TransportAddressArray(PINDEX initialSize = 0)
    00106       : ParentClass(initialSize) { }
    00107     H323TransportAddressArray(
    00108       const OpalTransportAddress & address
    00109     ) { AppendAddress(address); }
    00110     H323TransportAddressArray(
    00111       const H323TransportAddress & address
    00112     ) { AppendAddress(address); }
    00113     H323TransportAddressArray(
    00114       const H225_ArrayOf_TransportAddress & addresses
    00115     );
    00116     H323TransportAddressArray(
    00117       const OpalTransportAddressArray & array
    00118     ) { AppendStringCollection(array); }
    00119     H323TransportAddressArray(
    00120       const PStringArray & array
    00121     ) { AppendStringCollection(array); }
    00122     H323TransportAddressArray(
    00123       const PStringList & list
    00124     ) { AppendStringCollection(list); }
    00125     H323TransportAddressArray(
    00126       const PSortedStringList & list
    00127     ) { AppendStringCollection(list); }
    00128
    00129     void AppendString(
    00130       const char * address
    00131     );
    00132     void AppendString(
    00133       const PString & address
    00134     );
    00135     void AppendAddress(
    00136       const H323TransportAddress & address
    00137     );
    00138
    00139     virtual PObject * Clone() const
    00140     {
    00141       return new H323TransportAddressArray(0, this);
    00142     }
    00143
    00144   protected:
    00145     void AppendStringCollection(
    00146       const PCollection & coll
    00147     );
    00148 };
    00149
    00150
    00153 void H323SetTransportAddresses(
    00154   const H323Transport & associatedTransport,
    00155   const H323TransportAddressArray & addresses,
    00156   H225_ArrayOf_TransportAddress & pdu
    00157 );
    00158
    00159
    00160 #endif // OPAL_H323
    00161
    00162 #endif // OPAL_H323_TRANSADDR_H
    00163
    00164