File indexing completed on 2025-01-18 10:12:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TInetAddress
0013 #define ROOT_TInetAddress
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include "TObject.h"
0028 #include "TString.h"
0029
0030 #include <vector>
0031 #ifdef R__GLOBALSTL
0032 namespace std { using ::vector; }
0033 #endif
0034
0035
0036 class TInetAddress : public TObject {
0037
0038 friend class TSystem;
0039 friend class TUnixSystem;
0040 friend class TWinNTSystem;
0041 friend class TUUID;
0042 friend class TSocket;
0043 friend class TUDPSocket;
0044 friend class TServerSocket;
0045 friend class TXSocket;
0046
0047 public:
0048 typedef std::vector<UInt_t> AddressList_t;
0049 typedef std::vector<TString> AliasList_t;
0050
0051 private:
0052 TString fHostname;
0053 Int_t fFamily;
0054 Int_t fPort;
0055 AddressList_t fAddresses;
0056 AliasList_t fAliases;
0057
0058 TInetAddress(const char *host, UInt_t addr, Int_t family, Int_t port = -1);
0059 void AddAddress(UInt_t addr);
0060 void AddAlias(const char *alias);
0061
0062 public:
0063 TInetAddress();
0064 TInetAddress(const TInetAddress &adr);
0065 TInetAddress &operator=(const TInetAddress &rhs);
0066 virtual ~TInetAddress() { }
0067
0068 UInt_t GetAddress() const { return fAddresses[0]; }
0069 UChar_t *GetAddressBytes() const;
0070 const char *GetHostAddress() const;
0071 const char *GetHostName() const { return (const char *) fHostname; }
0072 Int_t GetFamily() const { return fFamily; }
0073 Int_t GetPort() const { return fPort; }
0074 const AddressList_t &GetAddresses() const { return fAddresses; }
0075 const AliasList_t &GetAliases() const { return fAliases; }
0076 Bool_t IsValid() const { return fFamily == -1 ? kFALSE : kTRUE; }
0077 void Print(Option_t *option="") const override;
0078
0079 static const char *GetHostAddress(UInt_t addr);
0080
0081 ClassDefOverride(TInetAddress,4)
0082 };
0083
0084 #endif