Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2333?usp=email
to review the following change.
Change subject: openvpn: make the context mode an enum
......................................................................
openvpn: make the context mode an enum
Turn the CM_* defines into enum context_mode and use it for
struct context.mode, so -Wswitch covers switches over it.
Drop the stale CM_THREAD mention from the comments.
Change-Id: Ifa05b9fd06e5d52818c91c5b160b6dd06ec71396
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/init.c
M src/openvpn/openvpn.h
2 files changed, 15 insertions(+), 10 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/2333/1
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 8b64944..10a232c 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -2768,6 +2768,9 @@
case CM_CHILD_TCP:
sec = c->options.ce.connect_retry_seconds;
break;
+
+ default:
+ break;
}
#ifdef ENABLE_DEBUG
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index ad6be88..f8ba760 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -430,6 +430,16 @@
};
+/** Role of a context within the OpenVPN process */
+enum context_mode
+{
+ CM_P2P, /**< standalone point-to-point session or client */
+ CM_TOP, /**< top level of a multi-client or point-to-multipoint
server */
+ CM_TOP_CLONE, /**< clone of a CM_TOP context for one thread */
+ CM_CHILD_UDP, /**< child context of a CM_TOP */
+ CM_CHILD_TCP, /**< child context of a CM_TOP */
+};
+
/**
* Contains all state information for one tunnel.
*
@@ -449,16 +459,8 @@
bool first_time; /**< True on the first iteration of
* OpenVPN's main loop. */
- /* context modes */
-#define CM_P2P 0 /* standalone point-to-point session or
client */
-#define CM_TOP 1 /* top level of a multi-client or
point-to-multipoint server */
-#define CM_TOP_CLONE 2 /* clone of a CM_TOP context for one thread */
-#define CM_CHILD_UDP 3 /* child context of a CM_TOP or CM_THREAD */
-#define CM_CHILD_TCP 4 /* child context of a CM_TOP or CM_THREAD */
- int mode; /**< Role of this context within the
- * OpenVPN process. Valid values are \c
- * CM_P2P, \c CM_TOP, \c CM_TOP_CLONE,
- * \c CM_CHILD_UDP, and \c CM_CHILD_TCP. */
+ enum context_mode mode; /**< Role of this context within the
+ * OpenVPN process. */
struct multi_context *multi; /**< Pointer to the main P2MP context.
* Non-NULL only when mode == CM_TOP. */
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2333?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifa05b9fd06e5d52818c91c5b160b6dd06ec71396
Gerrit-Change-Number: 2333
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel