RTP Audio System  2.0.0
packetaddress.h
Go to the documentation of this file.
00001 /*
00002  *  $Id: packetaddress.h 1285 2011-12-18 13:25:14Z dreibh $
00003  *
00004  * SocketAPI implementation for the sctplib.
00005  * Copyright (C) 2005-2012 by Thomas Dreibholz
00006  *
00007  * Realized in co-operation between
00008  * - Siemens AG
00009  * - University of Essen, Institute of Computer Networking Technology
00010  * - University of Applied Sciences, Muenster
00011  *
00012  * Acknowledgement
00013  * This work was partially funded by the Bundesministerium fuer Bildung und
00014  * Forschung (BMBF) of the Federal Republic of Germany (Foerderkennzeichen 01AK045).
00015  * The authors alone are responsible for the contents.
00016  *
00017  * This program is free software: you can redistribute it and/or modify
00018  * it under the terms of the GNU General Public License as published by
00019  * the Free Software Foundation, either version 3 of the License, or
00020  * (at your option) any later version.
00021 
00022  * This program is distributed in the hope that it will be useful,
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025  * GNU General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU General Public License
00028  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00029  *
00030  * Contact: discussion@sctp.de
00031  *          dreibh@iem.uni-due.de
00032  *          tuexen@fh-muenster.de
00033  *
00034  * Purpose: Packet address implementation
00035  *
00036  */
00037 
00038 
00039 #ifndef PACKETADDRESS_H
00040 #define PACKETADDRESS_H
00041 
00042 
00043 #include "tdsystem.h"
00044 #include "strings.h"
00045 #include "socketaddress.h"
00046 
00047 
00048 #if (SYSTEM == OS_Linux)
00049 
00050 #include <linux/if.h>
00051 
00052 
00053 
00061 class PacketAddress : virtual public SocketAddress
00062 {
00063    // ====== Constructors/Destructor ========================================
00064    public:
00068    PacketAddress();
00069 
00075    PacketAddress(const PacketAddress& address);
00076 
00083    PacketAddress(const String& name);
00084 
00091    PacketAddress(const sockaddr* address, cardinal length);
00092 
00096    ~PacketAddress();
00097 
00098 
00099    // ====== Initialization =================================================
00103    void reset();
00104 
00110    SocketAddress* duplicate() const;
00111 
00115    void init(const PacketAddress& address);
00116 
00120    void init(const String& name);
00121 
00125    inline PacketAddress& operator=(const PacketAddress& source);
00126 
00127 
00128    // ====== Address functions ==============================================
00134    bool isValid() const;
00135 
00141    integer getFamily() const;
00142 
00148    String getAddressString(const cardinal format = PF_Default) const;
00149 
00155    inline bool isNull() const;
00156 
00157 
00158    // ====== getPort() dummy ================================================
00164    card16 getPort() const;
00165 
00171    void setPort(const card16 port);
00172 
00173 
00174    // ====== Get/set system sockaddr structure ==============================
00180    cardinal getSystemAddress(sockaddr*       buffer,
00181                              const socklen_t length,
00182                              const cardinal  type) const;
00183 
00189    bool setSystemAddress(const sockaddr* address, const socklen_t length);
00190 
00191 
00192     // ====== Comparision operators =========================================
00196    int operator==(const PacketAddress& address) const;
00197 
00201    inline int operator!=(const PacketAddress& address) const;
00202 
00206    int operator<(const PacketAddress& address) const;
00207 
00211    inline int operator<=(const PacketAddress& address) const;
00212 
00216    int operator>(const PacketAddress& address) const;
00217 
00221    inline int operator>=(const PacketAddress& address) const;
00222 
00223 
00224    // ====== Private data ===================================================
00225    private:
00226    static const cardinal MaxNameLength = IFNAMSIZ - 1;
00227 
00228    char Name[MaxNameLength + 1];
00229 };
00230 
00231 
00232 #include "packetaddress.icc"
00233 
00234 
00235 #endif
00236 
00237 
00238 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines