summaryrefslogtreecommitdiffstats
path: root/socket.h
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
commit6add6b2fe78c549d174729869e26cee917e31d5f (patch)
tree7b0786b12c40853bd9742d61e07417ade430f3d2 /socket.h
parent34a507c9ab159a1e56715246c594b93a93d68469 (diff)
downloadopenvpn-6add6b2fe78c549d174729869e26cee917e31d5f.tar.gz
openvpn-6add6b2fe78c549d174729869e26cee917e31d5f.tar.xz
openvpn-6add6b2fe78c549d174729869e26cee917e31d5f.zip
Added --port-share option for allowing OpenVPN and HTTPS
server to share the same port number. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@893 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'socket.h')
-rw-r--r--socket.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/socket.h b/socket.h
index 79f06b5..82b3626 100644
--- a/socket.h
+++ b/socket.h
@@ -130,6 +130,12 @@ struct stream_buf
bool error; /* if true, fatal TCP error has occurred,
requiring that connection be restarted */
+#if PORT_SHARE
+# define PS_DISABLED 0
+# define PS_ENABLED 1
+# define PS_FOREIGN 2
+ int port_share_state;
+#endif
};
/*
@@ -540,6 +546,29 @@ link_socket_actual_match (const struct link_socket_actual *a1, const struct link
return addr_port_match (&a1->dest, &a2->dest);
}
+#if PORT_SHARE
+
+static inline bool
+socket_foreign_protocol_detected (const struct link_socket *sock)
+{
+ return link_socket_connection_oriented (sock)
+ && sock->stream_buf.port_share_state == PS_FOREIGN;
+}
+
+static inline const struct buffer *
+socket_foreign_protocol_head (const struct link_socket *sock)
+{
+ return &sock->stream_buf.buf;
+}
+
+static inline int
+socket_foreign_protocol_sd (const struct link_socket *sock)
+{
+ return sock->sd;
+}
+
+#endif
+
static inline bool
socket_connection_reset (const struct link_socket *sock, int status)
{