Fix FreeBSD build.
[haiku.git] / headers / os / net / NetAddress.h
blob23e6d158bf28a67d23161f652749506d3f3ebdc9
1 /*
2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef H_NETADDRESS
6 #define H_NETADDRESS
9 #include <BeBuild.h>
10 #include <SupportDefs.h>
11 #include <Archivable.h>
13 #include <netinet/in.h>
14 #include <sys/socket.h>
17 class BNetAddress : public BArchivable {
18 public:
19 BNetAddress(BMessage* archive);
20 virtual ~BNetAddress();
22 virtual status_t Archive(BMessage* into, bool deep = true) const;
23 static BArchivable* Instantiate(BMessage* archive);
25 BNetAddress(const char* hostname = 0, unsigned short port = 0);
26 BNetAddress(const struct sockaddr_in& addr);
27 BNetAddress(in_addr addr, int port = 0);
28 BNetAddress(uint32 addr, int port = 0);
29 BNetAddress(const BNetAddress& other);
30 BNetAddress(const char* hostname, const char* protocol,
31 const char* service);
33 BNetAddress& operator=(const BNetAddress&);
35 status_t InitCheck() const;
37 status_t SetTo(const char* hostname, const char* protocol,
38 const char* service);
39 status_t SetTo(const char* hostname = NULL, unsigned short port = 0);
40 status_t SetTo(const struct sockaddr_in& addr);
41 status_t SetTo(in_addr addr, int port = 0);
42 status_t SetTo(uint32 addr = INADDR_ANY, int port = 0);
44 status_t GetAddr(char* hostname = NULL,
45 unsigned short* port = NULL) const;
46 status_t GetAddr(struct sockaddr_in& addr) const;
47 status_t GetAddr(in_addr& addr, unsigned short* port = NULL) const;
49 // TODO: drop this compatibility cruft method after R1
50 status_t InitCheck();
52 private:
53 virtual void _ReservedBNetAddressFBCCruft1();
54 virtual void _ReservedBNetAddressFBCCruft2();
55 virtual void _ReservedBNetAddressFBCCruft3();
56 virtual void _ReservedBNetAddressFBCCruft4();
57 virtual void _ReservedBNetAddressFBCCruft5();
58 virtual void _ReservedBNetAddressFBCCruft6();
60 status_t fInit;
61 int16 fFamily;
62 int16 fPort;
63 int32 fAddress;
64 int32 fPrivateData[7];
67 #endif // H_NETADDRESS