summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-10 09:28:01 +0000
committerDenis Vlasenko2007-01-10 09:28:01 +0000
commit9de420c27cbbbd99bedc95782a6937039ff071bb (patch)
tree01c0783874d5c429b4f71496f18028d46afae302 /include
parent62a6983a818ce701b924f84bf23716c4fbff170a (diff)
downloadbusybox-9de420c27cbbbd99bedc95782a6937039ff071bb.zip
busybox-9de420c27cbbbd99bedc95782a6937039ff071bb.tar.gz
Improve generic ipv4+ipv6 support in libbb.
Convert telnet to it. Now this works: telnetd -b [::1]:1234 - bind to IPv6 non-standard port telnet [::1]:1234 - connect to IPv6 non-standard port telnet ::1 1234 - same This does not require ANY ipv6-specific code in applets (no struct sockaddr_in6. In fact, no sockaddr_in, too).
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 6f66c85..16f092f 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -293,18 +293,17 @@ extern void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen);
extern int xconnect_tcp_v4(struct sockaddr_in *s_addr);
extern struct hostent *xgethostbyname(const char *name);
extern struct hostent *xgethostbyname2(const char *name, int af);
-extern int xsocket_stream_ip4or6(sa_family_t *fp);
-typedef union {
- struct sockaddr sa;
- struct sockaddr_in sin;
-#if ENABLE_FEATURE_IPV6
- struct sockaddr_in6 sin6;
-#endif
-} sockaddr_inet;
-extern int dotted2sockaddr(const char *dotted, struct sockaddr* sp, int socklen);
-extern int create_and_bind_socket_ip4or6(const char *hostaddr, int port);
+
extern int setsockopt_reuseaddr(int fd);
extern int setsockopt_broadcast(int fd);
+/* Create server TCP socket bound to bindaddr:port. bindaddr can be NULL,
+ * numeric IP ("N.N.N.N") or numeric IPv6 address,
+ * and can have ":PORT" suffix. If no suffix trere, second argument is used */
+extern int create_and_bind_stream_or_die(const char *bindaddr, int port);
+/* Create client TCP socket connected to peer:port. Peer cannot be NULL.
+ * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname,
+ * and can have ":PORT" suffix. If no suffix trere, second argument is used */
+extern int create_and_connect_stream_or_die(const char *peer, int def_port);
extern char *xstrdup(const char *s);
@@ -506,7 +505,7 @@ USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out);
int inflate(int in, int out);
-unsigned short bb_lookup_port(const char *port, const char *protocol, unsigned short default_port);
+unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port);
void bb_lookup_host(struct sockaddr_in *s_in, const char *host);
int bb_make_directory(char *path, long mode, int flags);