From 78c896b3b3127515478090c19447e27dc406427e Mon Sep 17 00:00:00 2001 From: Jianfeng Tan Date: Mon, 18 Nov 2019 06:59:50 +0000 Subject: TLDKv2 Signed-off-by: Jianfeng Tan Signed-off-by: Jielong Zhou Signed-off-by: Jian Zhang Signed-off-by: Chen Zhao Change-Id: I55c39de4c6cd30f991f35631eb507f770230f08e --- lib/libtle_l4p/tle_tcp.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (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 b0cbda6..93e853e 100644 --- a/lib/libtle_l4p/tle_tcp.h +++ b/lib/libtle_l4p/tle_tcp.h @@ -49,6 +49,7 @@ struct tle_tcp_stream_cfg { struct tle_tcp_stream_param { struct tle_tcp_stream_addr addr; struct tle_tcp_stream_cfg cfg; + uint64_t option; }; /** @@ -85,6 +86,25 @@ tle_tcp_stream_open(struct tle_ctx *ctx, */ int tle_tcp_stream_close(struct tle_stream *s); +/** + * shutdown an open stream in SHUT_WR way. + * similar to tle_tcp_stream_close(), except: + * - rx still works + * - er still works + * @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_shutdown(struct tle_stream *s, int how); + +/** + * Send rst on this stream. + */ +void tle_tcp_stream_kill(struct tle_stream *s); + /** * close a group of open streams. * if the stream is in connected state, then: @@ -267,6 +287,15 @@ uint32_t tle_tcp_stream_update_cfg(struct tle_stream *ts[], uint16_t tle_tcp_stream_recv(struct tle_stream *s, struct rte_mbuf *pkt[], uint16_t num); +/** + * Get how many bytes are received in recv window. + * @param ts + * TCP stream to receive data from. + * @return + * bytes of data inside recv window. + */ +uint16_t tle_tcp_stream_inq(struct tle_stream *s); + /** * Reads iovcnt buffers from the for given TCP stream. * Note that the stream has to be in connected state. @@ -289,6 +318,19 @@ uint16_t tle_tcp_stream_recv(struct tle_stream *s, struct rte_mbuf *pkt[], ssize_t tle_tcp_stream_readv(struct tle_stream *ts, const struct iovec *iov, int iovcnt); +/** + * Like tle_tcp_stream_readv, but with more information returned in msghdr. + * Note that the stream has to be in connected state. + * @param ts + * TCP stream to receive data from. + * @param msg + * If not NULL, generate control message into msg_control field of msg. + * @return + * On success, number of bytes read in the stream receive buffer. + * In case of error, returns -1 and error code will be set in rte_errno. + */ +ssize_t tle_tcp_stream_recvmsg(struct tle_stream *ts, struct msghdr *msg); + /** * Consume and queue up to *num* packets, that will be sent eventually * by tle_tcp_tx_bulk(). @@ -420,6 +462,24 @@ uint16_t tle_tcp_tx_bulk(struct tle_dev *dev, struct rte_mbuf *pkt[], */ int tle_tcp_process(struct tle_ctx *ctx, uint32_t num); +/** + * Get tcp info of a tcp stream. + * This function is not multi-thread safe. + * @param ts + * TCP stream to get info from. + * @param info + * Pointer to store info. + * @param optlen + * Pointer to length of info. + * @return + * zero on successful completion. + * - ENOTCONN - connection is not connected yet. + */ +int +tle_tcp_stream_get_info(const struct tle_stream * ts, void *info, socklen_t *optlen); + +void tle_tcp_stream_set_keepalive(struct tle_stream *ts); + #ifdef __cplusplus } #endif -- cgit 1.2.3-korg