|
|
// ########################################################################## // #### #### // #### RTP Audio Server Project #### // #### ============================ #### // #### #### // #### Socket Address #### // #### #### // #### Version 1.00 -- February 04, 2001 #### // #### #### // #### Copyright (C) 1999 Thomas Dreibholz #### // #### 2000 Universität Bonn, Abt. IV #### // #### 2001 EMail: Dreibholz@bigfoot.com #### // #### WWW: http://www.bigfoot.com/~dreibholz #### // #### #### // ########################################################################## #ifndef SOCKETADDRESS_H #define SOCKETADDRESS_H #include "system.h" #include <sys/socket.h> #include <sys/un.h> namespace Coral { /** * This class is an interface for a socket address. * * @short Socket Address * @author Thomas Dreibholz (Dreibholz@bigfoot.com) * @version 1.0 */ class SocketAddress { // ====== Reset ========================================================== public: /** * Reset address. */ virtual void reset() = 0; // ====== Check, if address is valid ===================================== /** * Check, if address is valid. * * @return true, if address is valid; false otherwise. */ virtual bool isValid() const = 0; // ====== Get address string ============================================= /** * Get address string. * * @return Address string. */ virtual String getAddressString() const = 0; // ====== Get/set system sockaddr structure ============================== /** * Get system's sockaddr structure for the address. * * @param buffer Buffer to write sockaddr to. * @param length Length of buffer. * @param type AF_INET or AF_INET6. * @return Length of written sockaddr structure. */ virtual cardinal getSystemAddress(sockaddr* buffer, const socklen_t length, const cardinal type) const = 0; /** * Initialize the internet address from the system's sockaddr structure. The * sockaddr structure may be sockaddr_in (AF_INET) or sockaddr_in6 (AF_INET6). * * @param address sockaddr. * @param length Length of sockaddr (sizeof(sockaddr_in) or sizeof(sockaddr_in6)). */ virtual bool setSystemAddress(sockaddr* address, const socklen_t length) = 0; // ====== Constants ====================================================== /** * Maximum sockaddr length in bytes. */ static const cardinal MaxSockLen = (sizeof(sockaddr_un) > sizeof(sockaddr_storage)) ? sizeof(sockaddr_un) : sizeof(sockaddr_storage); }; /** * Output operator. */ inline ostream& operator<<(ostream& os, const SocketAddress& sa); } #include "socketaddress.icc" #endif
Generated by: viper@odin on Sun Feb 4 18:54:51 2001, using kdoc 2.0a22. |