diff options
author | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2021-07-06 15:08:48 +0000 |
---|---|---|
committer | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2021-07-06 15:08:48 +0000 |
commit | ace4313dfd1f17eac022e497bb412e8e290c05e3 (patch) | |
tree | 0aa3f12476d3a615dd47489154074144966a1dc9 /lib/libtle_l4p/tle_tcp.h | |
parent | a32eaa3d00beef6bb81e2aadc2088e9a937d1fd0 (diff) |
l4p/tcp: introduce tle_tcp_stream_get_state() API
tle_tcp_stream_get_state() allows user to query information regarding
stream state, control ops and remote termination events.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Change-Id: Ica22a5fe2e63fdece882935b76572142433a4ae1
Diffstat (limited to 'lib/libtle_l4p/tle_tcp.h')
-rw-r--r-- | lib/libtle_l4p/tle_tcp.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/libtle_l4p/tle_tcp.h b/lib/libtle_l4p/tle_tcp.h index 76f3476..df50a23 100644 --- a/lib/libtle_l4p/tle_tcp.h +++ b/lib/libtle_l4p/tle_tcp.h @@ -23,6 +23,44 @@ extern "C" { #endif /** + * TCP stream states + */ +enum { + TLE_TCP_ST_CLOSED, + TLE_TCP_ST_LISTEN, + TLE_TCP_ST_SYN_SENT, + TLE_TCP_ST_SYN_RCVD, + TLE_TCP_ST_ESTABLISHED, + TLE_TCP_ST_FIN_WAIT_1, + TLE_TCP_ST_FIN_WAIT_2, + TLE_TCP_ST_CLOSE_WAIT, + TLE_TCP_ST_CLOSING, + TLE_TCP_ST_LAST_ACK, + TLE_TCP_ST_TIME_WAIT, + TLE_TCP_ST_NUM +}; + +/** + * User control operations for TCP stream + */ +enum { + TLE_TCP_OP_LISTEN = 0x1, + TLE_TCP_OP_ACCEPT = 0x2, + TLE_TCP_OP_CONNECT = 0x4, + TLE_TCP_OP_ESTABLISH = 0x8, + TLE_TCP_OP_CLOSE = 0x10, +}; + +/** + * termination/error events from remote peer + */ +enum { + TLE_TCP_REV_FIN = 0x1, /** FIN received from peer*/ + TLE_TCP_REV_RST = 0x2, /** RST received from peer */ + TLE_TCP_REV_RTO = 0x4, /** receive timed-out */ +}; + +/** * TCP stream creation parameters. */ struct tle_tcp_stream_addr { @@ -81,6 +119,18 @@ struct tle_tcp_conn_info { }; /** + * TCP stream state information. + */ +struct tle_tcp_stream_state { + /** current TCP state (one of TLE_TCP_ST_*) */ + uint16_t state; + /** bitmask of control ops performed by user (TLE_TCP_OP_*) */ + uint16_t uop; + /** bitmask of remote termination events (TLE_TCP_REV_*) */ + uint16_t rev; +}; + +/** * create a new stream within given TCP context. * @param ctx * TCP context to create new stream within. @@ -158,6 +208,17 @@ tle_tcp_stream_get_addr(const struct tle_stream *s, */ int tle_tcp_stream_get_mss(const struct tle_stream *ts); +/** + * Get current TCP stream state + * @param ts + * Stream to retrieve state information from. + * @return + * zero on successful completion. + * - EINVAL - invalid parameter passed to function + */ +int tle_tcp_stream_get_state(const struct tle_stream *ts, + struct tle_tcp_stream_state *st); + struct tle_stream * tle_tcp_stream_establish(struct tle_ctx *ctx, const struct tle_tcp_stream_param *prm, |