diff options
author | Florin Coras <fcoras@cisco.com> | 2017-12-09 10:19:43 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-12-11 21:07:22 +0000 |
commit | 561af9b441c7392cf391dd46399b0b16b876a08a (patch) | |
tree | d5aa49c73728b6f7cb55071a5398ee9cdba53808 /src/vnet/session/application.c | |
parent | d78349109fdb98fa0ba5f5aff779be700ff78357 (diff) |
session: generalize handling of network transports
- compute session type out of transport and network protos
- make session, session lookup and session queue code network protocol
agnostic
This does not update the session layer to support non-ip network layer
protocols
Change-Id: Ifc2f92845e158b649d59462eb7d51c12af536691
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r-- | src/vnet/session/application.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 9a540f6b78c..4523d5da4e2 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -573,8 +573,8 @@ application_start_stop_proxy_fib_proto (application_t * app, u8 fib_proto, } void -application_start_stop_proxy (application_t * app, u8 transport_proto, - u8 is_start) +application_start_stop_proxy (application_t * app, + transport_proto_t transport_proto, u8 is_start) { if (application_has_local_scope (app)) { @@ -605,24 +605,34 @@ void application_setup_proxy (application_t * app) { u16 transports = app->proxied_transports; + transport_proto_t tp; + ASSERT (application_is_proxy (app)); if (application_is_builtin (app)) return; - if (transports & (1 << TRANSPORT_PROTO_TCP)) - application_start_stop_proxy (app, TRANSPORT_PROTO_TCP, 1); - if (transports & (1 << TRANSPORT_PROTO_UDP)) - application_start_stop_proxy (app, TRANSPORT_PROTO_UDP, 1); + + /* *INDENT-OFF* */ + transport_proto_foreach (tp, ({ + if (transports & (1 << tp)) + application_start_stop_proxy (app, tp, 1); + })); + /* *INDENT-ON* */ } void application_remove_proxy (application_t * app) { u16 transports = app->proxied_transports; + transport_proto_t tp; + ASSERT (application_is_proxy (app)); - if (transports & (1 << TRANSPORT_PROTO_TCP)) - application_start_stop_proxy (app, TRANSPORT_PROTO_TCP, 0); - if (transports & (1 << TRANSPORT_PROTO_UDP)) - application_start_stop_proxy (app, TRANSPORT_PROTO_UDP, 0); + + /* *INDENT-OFF* */ + transport_proto_foreach (tp, ({ + if (transports & (1 << tp)) + application_start_stop_proxy (app, tp, 0); + })); + /* *INDENT-ON* */ } u8 * |