aboutsummaryrefslogtreecommitdiff
path: root/src/pconfig.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-05-27 18:07:34 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-05-27 18:07:34 +0200
commited456a32ffe6fea0cb52b5184a00a14cb0059f4a (patch)
tree8970d63b89090e8eb778d97043af9b74999828ae /src/pconfig.h
parenta0fca977bf366b64a5cd3e1c71fce14a93b8a44c (diff)
splitted bigfat anon enum in pconfig.h into multiple smaller ones hoping to improve readability
* clang-format headers Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/pconfig.h')
-rw-r--r--src/pconfig.h124
1 files changed, 68 insertions, 56 deletions
diff --git a/src/pconfig.h b/src/pconfig.h
index 53fcbe7..140cad5 100644
--- a/src/pconfig.h
+++ b/src/pconfig.h
@@ -47,50 +47,68 @@
#define PCONFIG_H 1
enum {
- /** Ping tunnel's operating mode (client) */
- kMode_forward = 0,
- /** Ping tunnel's operating mode (server) */
- kMode_proxy,
- /** Set this constant to the number of
- * concurrent connections you wish to handle by default.
- */
- kMax_tunnels = 10,
- /** Different verbosity levels. */
- kNo_log = -1,
- kLog_error = 0,
- kLog_info,
- kLog_event,
- kLog_verbose,
- kLog_debug,
- kLog_sendrecv,
- /** numbers */
- kIP_packet_max_size = 576,
- /** In bytes, mind you */
- kIP_header_size = 20,
- kIP_actual_size = (kIP_packet_max_size - kIP_header_size) - ((kIP_packet_max_size - kIP_header_size) % 8),
- /** Also in bytes */
- kICMP_header_size = 8,
- /** This constant control the maximum size of
- * the payload-portion of the ICMP packets
- * we send. Note that this does not include
- * the IP or ICMP headers!
- */
- kDefault_buf_size = 1024,
- /** Type code for echo request and replies */
- kICMP_echo_request = 8,
- kICMP_echo_reply = 0,
- /** number of packets we can have in our send/receive ring */
- kPing_window_size = 64,
- /** Tunnels are automatically closed after one minute of inactivity. Since
- * we continously send acknowledgements between the two peers, this mechanism
- * won't disconnect "valid" connections.
- */
- kAutomatic_close_timeout = 60, // Seconds!
- /** size of md5 digest in bytes */
- kMD5_digest_size = 16,
- /** size of sha512 digest in bytes */
- kSHA512_digest_size = 64,
- /** These constants are used to indicate the protocol state. The protocol
+ /** Set this constant to the number of
+ * concurrent connections you wish to handle by default.
+ */
+ kMax_tunnels = 10,
+ /** numbers */
+ kIP_packet_max_size = 576,
+ /** In bytes, mind you */
+ kIP_header_size = 20,
+ kIP_actual_size = (kIP_packet_max_size - kIP_header_size) - ((kIP_packet_max_size - kIP_header_size) % 8),
+ /** Also in bytes */
+ kICMP_header_size = 8,
+ /** This constant control the maximum size of
+ * the payload-portion of the ICMP packets
+ * we send. Note that this does not include
+ * the IP or ICMP headers!
+ */
+ kDefault_buf_size = 1024,
+ /** Type code for echo request and replies */
+ kICMP_echo_request = 8,
+ kICMP_echo_reply = 0,
+ /** number of packets we can have in our send/receive ring */
+ kPing_window_size = 64,
+ /** Tunnels are automatically closed after one minute of inactivity. Since
+ * we continously send acknowledgements between the two peers, this mechanism
+ * won't disconnect "valid" connections.
+ */
+ kAutomatic_close_timeout = 60, // Seconds!
+ /** size of md5 digest in bytes */
+ kMD5_digest_size = 16,
+ /** size of sha512 digest in bytes */
+ kSHA512_digest_size = 64,
+ kDNS_port = 53
+};
+
+enum oper_mode {
+ /** Ping tunnel's operating mode (client) */
+ kMode_forward = 0,
+ /** Ping tunnel's operating mode (server) */
+ kMode_proxy
+};
+
+enum pkt_flag {
+ /** set when packet comes from a user */
+ kUser_flag = 1 << 30,
+ /** set when packet comes from the proxy */
+ kProxy_flag = 1 << 31,
+ kFlag_mask = kUser_flag | kProxy_flag
+};
+
+enum log_level {
+ /** Different verbosity levels. */
+ kNo_log = -1,
+ kLog_error = 0,
+ kLog_info,
+ kLog_event,
+ kLog_verbose,
+ kLog_debug,
+ kLog_sendrecv
+};
+
+enum proxy_state {
+ /** These constants are used to indicate the protocol state. The protocol
* works as follows:
* - The identifier is used by both the proxy and the forwarder
* to identify the session (and thus the relevant sockets).
@@ -118,18 +136,12 @@ enum {
* actually returning the ping. This is mostly relevant for users, and for
* proxies running in unprivileged mode.
*/
- kProxy_start = 0,
- kProto_ack,
- kProto_data,
- kProto_close,
- kProto_authenticate,
- kNum_proto_types,
- /** set when packet comes from a user */
- kUser_flag = 1 << 30,
- /** set when packet comes from the proxy */
- kProxy_flag = 1 << 31,
- kFlag_mask = kUser_flag | kProxy_flag,
- kDNS_port = 53
+ kProxy_start = 0,
+ kProto_ack,
+ kProto_data,
+ kProto_close,
+ kProto_authenticate,
+ kNum_proto_types
};
#endif