4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef HH_INetAddressing_
24 #define HH_INetAddressing_ 1
29 #include <netinet/in.h>
30 #include "SocketPolicy.hh"
31 #include "ClientSocketHandle.hh"
32 #include "CommunicationPolicy.hh"
33 #include "GenericAddressingPolicy.hh"
35 //#include "INetAddressing.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
43 \todo Implement real INet4Address datatype and
44 rename this one to INet4SockAddress ...
46 \todo Implement more complete interface
52 INet4Address(char const * address);
53 INet4Address(std::string address);
54 INet4Address(std::string host, unsigned port);
56 bool operator==(INet4Address const & other) const;
58 std::string str() const;
59 std::string host() const;
60 unsigned port() const;
64 struct sockaddr * sockaddr_p();
65 struct sockaddr const * sockaddr_p() const;
66 unsigned sockaddr_len() const;
69 void assignString(std::string addr);
71 struct ::sockaddr_in addr_;
74 std::ostream & operator<<(std::ostream & os, INet4Address const & addr);
84 struct INet4AddressingPolicy
85 : public AddressingPolicyBase,
86 private GenericAddressingPolicy<INet4Address>
88 typedef INet4Address Address;
90 using GenericAddressingPolicy<INet4Address>::peer;
91 using GenericAddressingPolicy<INet4Address>::local;
92 using GenericAddressingPolicy<INet4Address>::connect;
93 using GenericAddressingPolicy<INet4Address>::bind;
100 struct INet6AddressingPolicy : public AddressingPolicyBase
102 typedef INet6Address Address;
105 struct InvalidINetAddressException : public std::exception
106 { char const * what() const throw() { return "invalid inet address"; } };
110 ///////////////////////////////hh.e////////////////////////////////////////
111 #include "INetAddressing.cci"
112 //#include "INetAddressing.ct"
113 //#include "INetAddressing.cti"
114 //#include "INetAddressing.mpp"
120 // c-file-style: "senf"