ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/sockinfo.h
(Generate patch)

Comparing gvpe/src/sockinfo.h (file contents):
Revision 1.3 by pcg, Wed Apr 2 05:15:00 2003 UTC vs.
Revision 1.5 by pcg, Sat Apr 5 17:54:22 2003 UTC

33 u32 host; 33 u32 host;
34 u16 port; 34 u16 port;
35 u8 prot; 35 u8 prot;
36 u8 pad1; 36 u8 pad1;
37 37
38 void set (const sockaddr_in *sa, u8 prot_ = PROT_UDPv4); 38 void set (const sockaddr_in *sa, u8 prot_);
39 void set (const conf_node *conf, u8 prot_ = PROT_UDPv4); 39 void set (const conf_node *conf, u8 prot_);
40
41 // return the supported protocols
42 u8 supported_protocols (conf_node *conf = 0);
43 bool upgrade_protocol (u8 prot_, conf_node *conf = 0);
40 44
41 operator const char *() const; 45 operator const char *() const;
42 46
43 const sockaddr *sav4 () const; 47 const sockaddr *sav4 () const;
44 const socklen_t salenv4 () const 48 const socklen_t salenv4 () const
45 { return sizeof (sockaddr_in); } 49 { return sizeof (sockaddr_in); }
46 50
47 const char *ntoa () const; 51 const char *ntoa () const;
48 52
53 bool valid () const
54 { return prot != 0 && host != 0; }
55
49 sockinfo() { prot = 0; } 56 sockinfo() { prot = 0; }
50 57
51 sockinfo(const sockaddr_in &sa, u8 prot_ = PROT_UDPv4) 58 sockinfo(const sockaddr_in &sa, u8 prot)
52 { set (&sa, prot_); } 59 { set (&sa, prot); }
53 60
54 sockinfo(const conf_node *conf, u8 prot_ = PROT_UDPv4) 61 sockinfo(const conf_node *conf, u8 prot)
55 { set (conf, prot_); } 62 { set (conf, prot); }
56 }; 63 };
57 64
58inline bool
59operator == (const sockinfo &a, const sockinfo &b) 65bool operator == (const sockinfo &a, const sockinfo &b);
60{ 66bool operator < (const sockinfo &a, const sockinfo &b);
61 return a.host == b.host && a.port == b.port && a.prot == b.prot;
62}
63 67
64#endif 68#endif
65 69

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines