From d2baf65c86ac164346f25828c54775bab8343841 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Wed, 7 Jul 2021 17:25:00 +0000 Subject: l4p/tcp: introduce tle_tcp_stream_abort() API Introduce ability ot perform abnormal connection termination. Signed-off-by: Konstantin Ananyev Change-Id: I75b5153505348ceface903cd2c8e012707631168 --- lib/libtle_l4p/tle_tcp.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib/libtle_l4p/tle_tcp.h') diff --git a/lib/libtle_l4p/tle_tcp.h b/lib/libtle_l4p/tle_tcp.h index df50a23..289683f 100644 --- a/lib/libtle_l4p/tle_tcp.h +++ b/lib/libtle_l4p/tle_tcp.h @@ -49,8 +49,11 @@ enum { TLE_TCP_OP_CONNECT = 0x4, TLE_TCP_OP_ESTABLISH = 0x8, TLE_TCP_OP_CLOSE = 0x10, + TLE_TCP_OP_ABORT = 0x20, }; +#define TLE_TCP_OP_CLOSE_ABORT (TLE_TCP_OP_CLOSE | TLE_TCP_OP_ABORT) + /** * termination/error events from remote peer */ @@ -154,7 +157,7 @@ tle_tcp_stream_open(struct tle_ctx *ctx, * - if stream contains unsent data, then actual close will be postponed * till either remaining data will be TX-ed, or timeout will expire. * All packets that belong to that stream and remain in the device - * TX queue will be kept for father transmission. + * TX queue will be kept for further transmission. * @param s * Pointer to the stream to close. * @return @@ -164,6 +167,25 @@ tle_tcp_stream_open(struct tle_ctx *ctx, */ int tle_tcp_stream_close(struct tle_stream *s); +/** + * abnormal stream termination. + * if the stream is in connected state, then: + * - abnormal connection termination would be performed. + * - if stream contains unread data, then it will be wiped out. + * - if stream contains unsent data, then it will be wiped out, + * without further attempt to TX it. + * All packets that belong to that stream and remain in the device + * TX queue will be kept for further transmission. + * @param s + * Pointer to the stream to close. + * @return + * zero on successful completion. + * - -EINVAL - invalid parameter passed to function + * - -EDEADLK - close was already invoked on that stream + */ +int tle_tcp_stream_abort(struct tle_stream *s); + + /** * close a group of open streams. * if the stream is in connected state, then: -- cgit 1.2.3-korg