From 3e2cd52a6ae2345a44f39761beb5315a45832d95 Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Thu, 9 May 2019 11:26:31 +0200 Subject: [HICN-192] Add interface to administratively set a connection up and down MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8d00262fd8601328a50d0e2a6bef952031246818 Signed-off-by: Jordan Augé --- hicn-light/src/hicn/io/ioOperations.h | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'hicn-light/src/hicn/io/ioOperations.h') diff --git a/hicn-light/src/hicn/io/ioOperations.h b/hicn-light/src/hicn/io/ioOperations.h index c5e58d8b2..7a48b7e3e 100644 --- a/hicn-light/src/hicn/io/ioOperations.h +++ b/hicn-light/src/hicn/io/ioOperations.h @@ -26,6 +26,7 @@ #ifndef io_h #define io_h +#include #include #include #include @@ -58,6 +59,14 @@ typedef struct io_ops IoOperations; * IoOperations. * @constant getConnectionType Returns the type of connection (TCP, UDP, L2, * etc.) of the underlying connection. + * @constant getState Returns the current state of the connection (redundant + * with isUp for added for completeness of the API). + * @constant setState Allows to mark the current state of a connection. + * @constant getAdminState Returns the administrative state of a connection (as + * requested by the user, which might occasionally differ from the current + * state). + * @constant setAdminState Allows to set the administrative state of a + * connection. * @discussion <#Discussion#> */ struct io_ops { @@ -74,6 +83,10 @@ struct io_ops { const void *(*class)(const IoOperations *ops); list_connections_type (*getConnectionType)(const IoOperations *ops); Ticks (*sendProbe)(IoOperations *ops, unsigned probeType, uint8_t *message); + connection_state_t (*getState)(const IoOperations *ops); + void (*setState)(IoOperations *ops, connection_state_t state); + connection_state_t (*getAdminState)(const IoOperations *ops); + void (*setAdminState)(IoOperations *ops, connection_state_t admin_state); }; /** @@ -365,4 +378,39 @@ list_connections_type ioOperations_GetConnectionType(const IoOperations *ops); Ticks ioOperations_SendProbe(IoOperations *ops, unsigned probeType, uint8_t *message); + +/** + * Returns the current state of the connection + * + * @param [in] ops The connection implementation. + * + * @return Connection state (connection_state_t). + */ +connection_state_t ioOperations_GetState(const IoOperations *ops); + +/** + * Sets the current state of the connection + * + * @param [in] ops The connection implementation. + * @param [in] state New state to set (connection_state_t). + */ +void ioOperations_SetState(IoOperations *ops, connection_state_t state); + +/** + * Returns the administrative state of the connection + * + * @param [in] ops The connection implementation. + * + * @return Connection state (connection_state_t). + */ +connection_state_t ioOperations_GetAdminState(const IoOperations *ops); + +/** + * Sets the administrative state of the connection + * + * @param [in] ops The connection implementation. + * @param [in] state New state to set (connection_state_t). + */ +void ioOperations_SetAdminState(IoOperations *ops, connection_state_t admin_state); + #endif // io_h -- cgit 1.2.3-korg