X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fraw_socket.hxx;h=2b5031f31df0a7bdec937def8772b5447c504dcc;hb=eafea282664cbbf3316a068ce6683990cb1d5486;hp=e3f50daf67af17a710b1d5396458dcbda188ea6c;hpb=5f07efa12af93a7356930ddc1abc77a947f22092;p=simgear.git diff --git a/simgear/io/raw_socket.hxx b/simgear/io/raw_socket.hxx index e3f50daf..2b5031f3 100644 --- a/simgear/io/raw_socket.hxx +++ b/simgear/io/raw_socket.hxx @@ -23,9 +23,15 @@ #ifndef SG_IO_SOCKET_HXX #define SG_IO_SOCKET_HXX -#include -#include +//#include +//#if defined(__APPLE__) || defined(__FreeBSD__) +//# include +//#endif + +struct sockaddr_in; +struct sockaddr; + namespace simgear { @@ -34,11 +40,15 @@ namespace simgear */ class IPAddress { + struct sockaddr_in* addr; public: - IPAddress () {} + IPAddress () : addr(0) {} IPAddress ( const char* host, int port ) ; - IPAddress ( struct sockaddr* addr, size_t len ); + ~IPAddress(); + IPAddress( const IPAddress& other ); + const IPAddress& operator=(const IPAddress& other); + void set ( const char* host, int port ) ; const char* getHost () const ; unsigned int getPort() const ; @@ -48,14 +58,8 @@ public: bool getBroadcast () const ; - void setPort(unsigned int port); - const struct sockaddr_in* getAddress() const - { return &_raw; } - - const size_t getAddressSize() const - { return sizeof(struct sockaddr_in); } -private: - struct sockaddr_in _raw; + unsigned int getAddrLen() const; + sockaddr* getAddr() const; }; @@ -82,7 +86,7 @@ public: int listen ( int backlog ) ; int accept ( IPAddress* addr ) ; int connect ( const char* host, int port ) ; - int connect ( const IPAddress& addr ) ; + int connect ( IPAddress* addr ) ; int send ( const void * buffer, int size, int flags = 0 ) ; int sendto ( const void * buffer, int size, int flags, const IPAddress* to ) ; int recv ( void * buffer, int size, int flags = 0 ) ;