Overhauled BNetEndpoint implementation (and BNetAddress, too):
* added NetEndpointTest that exposed a couple of bugs * fixed several bugs in the implementation of BNetEndpoint, some of which kept NetPenguin from working * fixed a couple of constness issues in BNetEndpoint and BNetAddress git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -27,22 +27,28 @@ class BNetAddress : public BArchivable {
|
||||
BNetAddress(in_addr addr, int port = 0);
|
||||
BNetAddress(uint32 addr, int port = 0);
|
||||
BNetAddress(const BNetAddress& other);
|
||||
BNetAddress(const char* hostname, const char* protocol, const char* service);
|
||||
BNetAddress(const char* hostname, const char* protocol,
|
||||
const char* service);
|
||||
|
||||
BNetAddress& operator=(const BNetAddress&);
|
||||
|
||||
status_t InitCheck();
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetTo(const char* hostname, const char* protocol, const char* service);
|
||||
status_t SetTo(const char* hostname, const char* protocol,
|
||||
const char* service);
|
||||
status_t SetTo(const char* hostname = NULL, unsigned short port = 0);
|
||||
status_t SetTo(const struct sockaddr_in& addr);
|
||||
status_t SetTo(in_addr addr, int port = 0);
|
||||
status_t SetTo(uint32 addr = INADDR_ANY, int port = 0);
|
||||
|
||||
status_t GetAddr(char* hostname = NULL, unsigned short* port = NULL) const;
|
||||
status_t GetAddr(char* hostname = NULL,
|
||||
unsigned short* port = NULL) const;
|
||||
status_t GetAddr(struct sockaddr_in& addr) const;
|
||||
status_t GetAddr(in_addr& addr, unsigned short* port = NULL) const;
|
||||
|
||||
// TODO: drop this compatibility cruft method after R1
|
||||
status_t InitCheck();
|
||||
|
||||
private:
|
||||
virtual void _ReservedBNetAddressFBCCruft1();
|
||||
virtual void _ReservedBNetAddressFBCCruft2();
|
||||
|
||||
@@ -25,18 +25,19 @@ class BNetEndpoint : public BArchivable {
|
||||
|
||||
BNetEndpoint& operator=(const BNetEndpoint& other);
|
||||
|
||||
status_t InitCheck();
|
||||
status_t InitCheck() const;
|
||||
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
|
||||
status_t SetProtocol(int protocol);
|
||||
int SetOption(int32 option, int32 level, const void* data, unsigned int dataSize);
|
||||
int SetOption(int32 option, int32 level, const void* data,
|
||||
unsigned int dataSize);
|
||||
int SetNonBlocking(bool on = true);
|
||||
int SetReuseAddr(bool on = true);
|
||||
|
||||
const BNetAddress& LocalAddr();
|
||||
const BNetAddress& RemoteAddr();
|
||||
const BNetAddress& LocalAddr() const;
|
||||
const BNetAddress& RemoteAddr() const;
|
||||
|
||||
int Socket() const;
|
||||
|
||||
@@ -71,7 +72,14 @@ class BNetEndpoint : public BArchivable {
|
||||
|
||||
virtual bool IsDataPending(bigtime_t timeout = 0);
|
||||
|
||||
// TODO: drop these compatibility cruft methods after R1
|
||||
status_t InitCheck();
|
||||
const BNetAddress& LocalAddr();
|
||||
const BNetAddress& RemoteAddr();
|
||||
|
||||
private:
|
||||
status_t _SetupSocket();
|
||||
|
||||
virtual void _ReservedBNetEndpointFBCCruft1();
|
||||
virtual void _ReservedBNetEndpointFBCCruft2();
|
||||
virtual void _ReservedBNetEndpointFBCCruft3();
|
||||
@@ -79,14 +87,17 @@ class BNetEndpoint : public BArchivable {
|
||||
virtual void _ReservedBNetEndpointFBCCruft5();
|
||||
virtual void _ReservedBNetEndpointFBCCruft6();
|
||||
|
||||
status_t fInit;
|
||||
status_t fStatus;
|
||||
int fFamily;
|
||||
int fType;
|
||||
int fProtocol;
|
||||
int fSocket;
|
||||
bigtime_t fTimeout;
|
||||
int fLastError;
|
||||
BNetAddress fAddr;
|
||||
BNetAddress fPeer;
|
||||
|
||||
int32 _reserved[18];
|
||||
int32 _reserved[16];
|
||||
};
|
||||
|
||||
|
||||
#endif // H_NETENDPOINT
|
||||
|
||||
Reference in New Issue
Block a user