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

Comparing gvpe/src/sockinfo.C (file contents):
Revision 1.24 by root, Tue Feb 8 23:11:36 2011 UTC vs.
Revision 1.28 by root, Tue Jan 17 21:38:11 2012 UTC

113 sprintf (hostport, "%.15s", inet_ntoa (ia)); 113 sprintf (hostport, "%.15s", inet_ntoa (ia));
114 114
115 return hostport; 115 return hostport;
116} 116}
117 117
118bool
119sockinfo::valid () const
120{
121 return (prot & THISNODE->protocols) && host;
122}
123
118sockinfo::operator const char *() const 124sockinfo::operator const char *() const
119{ 125{
120 in_addr ia = { host }; 126 in_addr ia = { host };
121 127
122 sprintf (hostport, "%s/%.15s:%d", strprotocol (prot), inet_ntoa (ia), ntohs (port) & 0xffff); 128 sprintf (hostport, "%s/%.15s:%d", strprotocol (prot), inet_ntoa (ia), ntohs (port) & 0xffff);
127u8 133u8
128sockinfo::supported_protocols (conf_node *conf) 134sockinfo::supported_protocols (conf_node *conf)
129{ 135{
130 u8 protocols = prot; 136 u8 protocols = prot;
131 137
132 if (prot & (PROT_UDPv4 | PROT_TCPv4)) 138 if (prot & (PROT_IPv4 | PROT_ICMPv4 | PROT_UDPv4 | PROT_TCPv4))
133 protocols |= PROT_IPv4 | PROT_ICMPv4; 139 protocols |= PROT_IPv4 | PROT_ICMPv4;
134 140
135 if (conf
136 && prot & PROTv4 141 if (conf && prot & PROTv4)
137 && conf->protocols & PROT_UDPv4 142 {
138 && conf->udp_port) 143 if (conf->protocols & PROT_UDPv4 && conf->udp_port)
139 protocols |= PROT_UDPv4; 144 protocols |= PROT_UDPv4;
140 145
141 if (conf 146 if (conf->protocols & PROT_TCPv4 && conf->tcp_port)
142 && prot & PROTv4
143 && conf->protocols & PROT_TCPv4
144 && conf->tcp_port)
145 protocols |= PROT_TCPv4; 147 protocols |= PROT_TCPv4;
146 148
147 if (conf 149 if (conf->protocols & PROT_DNSv4 && conf->dns_port)
148 && prot & PROTv4
149 && conf->protocols & PROT_DNSv4
150 && conf->dns_port)
151 protocols |= PROT_DNSv4; 150 protocols |= PROT_DNSv4;
151 }
152 152
153 return protocols; 153 return protocols;
154} 154}
155 155
156bool 156bool

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines