1 | /* |
1 | /* |
2 | sockinfo.h -- socket address management |
2 | sockinfo.h -- socket address management |
3 | |
|
|
4 | Copyright (C) 2003 Marc Lehmann <pcg@goof.com> |
3 | Copyright (C) 2003 Marc Lehmann <pcg@goof.com> |
5 | |
4 | |
6 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
19 | */ |
18 | */ |
20 | |
19 | |
21 | #ifndef VPE_SOCKINFO_H__ |
20 | #ifndef VPE_SOCKINFO_H__ |
22 | #define VPE_SOCKINFO_H__ |
21 | #define VPE_SOCKINFO_H__ |
23 | |
22 | |
24 | #include <sys/socket.h> |
23 | #include "netcompat.h" |
25 | #include <netinet/in.h> |
|
|
26 | |
24 | |
27 | #include "conf.h" |
25 | #include "conf.h" |
28 | |
26 | |
29 | // encapsulate one or more network addresses. this structure |
27 | // encapsulate one or more network addresses. this structure |
30 | // gets transferred over the wire, so be careful with endianness etc. |
28 | // gets transferred over the wire, so be careful with endianness etc. |
… | |
… | |
35 | u8 prot; |
33 | u8 prot; |
36 | u8 pad1; |
34 | u8 pad1; |
37 | |
35 | |
38 | void set (const sockaddr_in *sa, u8 prot_); |
36 | void set (const sockaddr_in *sa, u8 prot_); |
39 | void set (const conf_node *conf, u8 prot_); |
37 | void set (const conf_node *conf, u8 prot_); |
|
|
38 | void set (const char *hostname, u16 port_, u8 prot_); |
|
|
39 | |
|
|
40 | // return the supported protocols |
|
|
41 | u8 supported_protocols (conf_node *conf = 0); |
|
|
42 | bool upgrade_protocol (u8 prot_, conf_node *conf = 0); |
40 | |
43 | |
41 | operator const char *() const; |
44 | operator const char *() const; |
42 | |
45 | |
43 | const sockaddr *sav4 () const; |
46 | const sockaddr *sav4 () const; |
44 | const socklen_t salenv4 () const |
47 | const socklen_t salenv4 () const |