REORG: stream-int/conn-stream: Move remaining functions to conn-stream

functions to get or set blocking flags on a conn-stream are moved to
conn_stream.h.
This commit is contained in:
Christopher Faulet 2022-04-04 09:00:59 +02:00
parent 5e29b76ea6
commit 1d03e6e3a1
2 changed files with 135 additions and 134 deletions

View File

@ -244,4 +244,139 @@ static inline struct conn_stream *cs_conn_get_first(const struct connection *con
return conn->mux->get_first_cs(conn);
}
/* Returns non-zero if the stream interface's Rx path is blocked */
static inline int cs_rx_blocked(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_RXBLK_ANY);
}
/* Returns non-zero if the conn-stream's Rx path is blocked because of lack
* of room in the input buffer.
*/
static inline int cs_rx_blocked_room(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_RXBLK_ROOM);
}
/* Returns non-zero if the conn-stream's endpoint is ready to receive */
static inline int cs_rx_endp_ready(const struct conn_stream *cs)
{
return !(cs->endp->flags & CS_EP_RX_WAIT_EP);
}
/* The conn-stream announces it is ready to try to deliver more data to the input buffer */
static inline void cs_rx_endp_more(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RX_WAIT_EP;
}
/* The conn-stream announces it doesn't have more data for the input buffer */
static inline void cs_rx_endp_done(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RX_WAIT_EP;
}
/* Tell a conn-stream the input channel is OK with it sending it some data */
static inline void cs_rx_chan_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_CHAN;
}
/* Tell a conn-stream the input channel is not OK with it sending it some data */
static inline void cs_rx_chan_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_CHAN;
}
/* Tell a conn-stream the other side is connected */
static inline void cs_rx_conn_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_CONN;
}
/* Tell a conn-stream it must wait for the other side to connect */
static inline void cs_rx_conn_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_CONN;
}
/* The conn-stream just got the input buffer it was waiting for */
static inline void cs_rx_buff_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_BUFF;
}
/* The conn-stream failed to get an input buffer and is waiting for it.
* Since it indicates a willingness to deliver data to the buffer that will
* have to be retried, we automatically clear RXBLK_ENDP to be called again
* as soon as RXBLK_BUFF is cleared.
*/
static inline void cs_rx_buff_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_BUFF;
}
/* Tell a conn-stream some room was made in the input buffer */
static inline void cs_rx_room_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_ROOM;
}
/* The conn-stream announces it failed to put data into the input buffer
* by lack of room. Since it indicates a willingness to deliver data to the
* buffer that will have to be retried, we automatically clear RXBLK_ENDP to
* be called again as soon as RXBLK_ROOM is cleared.
*/
static inline void cs_rx_room_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_ROOM;
}
/* The conn-stream announces it will never put new data into the input
* buffer and that it's not waiting for its endpoint to deliver anything else.
* This function obviously doesn't have a _rdy equivalent.
*/
static inline void cs_rx_shut_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_SHUT;
}
/* Returns non-zero if the conn-stream's Tx path is blocked */
static inline int cs_tx_blocked(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_WAIT_DATA);
}
/* Returns non-zero if the conn-stream's endpoint is ready to transmit */
static inline int cs_tx_endp_ready(const struct conn_stream *cs)
{
return (cs->endp->flags & CS_EP_WANT_GET);
}
/* Report that a conn-stream wants to get some data from the output buffer */
static inline void cs_want_get(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_WANT_GET;
}
/* Report that a conn-stream failed to get some data from the output buffer */
static inline void cs_cant_get(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_WANT_GET | CS_EP_WAIT_DATA;
}
/* Report that a conn-stream doesn't want to get data from the output buffer */
static inline void cs_stop_get(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_WANT_GET;
}
/* Report that a conn-stream won't get any more data from the output buffer */
static inline void cs_done_get(struct conn_stream *cs)
{
cs->endp->flags &= ~(CS_EP_WANT_GET | CS_EP_WAIT_DATA);
}
#endif /* _HAPROXY_CONN_STREAM_H */

View File

@ -42,140 +42,6 @@ static inline int si_init(struct stream_interface *si)
return 0;
}
/* Returns non-zero if the stream interface's Rx path is blocked */
static inline int cs_rx_blocked(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_RXBLK_ANY);
}
/* Returns non-zero if the conn-stream's Rx path is blocked because of lack
* of room in the input buffer.
*/
static inline int cs_rx_blocked_room(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_RXBLK_ROOM);
}
/* Returns non-zero if the conn-stream's endpoint is ready to receive */
static inline int cs_rx_endp_ready(const struct conn_stream *cs)
{
return !(cs->endp->flags & CS_EP_RX_WAIT_EP);
}
/* The conn-stream announces it is ready to try to deliver more data to the input buffer */
static inline void cs_rx_endp_more(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RX_WAIT_EP;
}
/* The conn-stream announces it doesn't have more data for the input buffer */
static inline void cs_rx_endp_done(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RX_WAIT_EP;
}
/* Tell a conn-stream the input channel is OK with it sending it some data */
static inline void cs_rx_chan_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_CHAN;
}
/* Tell a conn-stream the input channel is not OK with it sending it some data */
static inline void cs_rx_chan_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_CHAN;
}
/* Tell a conn-stream the other side is connected */
static inline void cs_rx_conn_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_CONN;
}
/* Tell a conn-stream it must wait for the other side to connect */
static inline void cs_rx_conn_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_CONN;
}
/* The conn-stream just got the input buffer it was waiting for */
static inline void cs_rx_buff_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_BUFF;
}
/* The conn-stream failed to get an input buffer and is waiting for it.
* Since it indicates a willingness to deliver data to the buffer that will
* have to be retried, we automatically clear RXBLK_ENDP to be called again
* as soon as RXBLK_BUFF is cleared.
*/
static inline void cs_rx_buff_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_BUFF;
}
/* Tell a conn-stream some room was made in the input buffer */
static inline void cs_rx_room_rdy(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_RXBLK_ROOM;
}
/* The conn-stream announces it failed to put data into the input buffer
* by lack of room. Since it indicates a willingness to deliver data to the
* buffer that will have to be retried, we automatically clear RXBLK_ENDP to
* be called again as soon as RXBLK_ROOM is cleared.
*/
static inline void cs_rx_room_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_ROOM;
}
/* The conn-stream announces it will never put new data into the input
* buffer and that it's not waiting for its endpoint to deliver anything else.
* This function obviously doesn't have a _rdy equivalent.
*/
static inline void cs_rx_shut_blk(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_RXBLK_SHUT;
}
/* Returns non-zero if the conn-stream's Tx path is blocked */
static inline int cs_tx_blocked(const struct conn_stream *cs)
{
return !!(cs->endp->flags & CS_EP_WAIT_DATA);
}
/* Returns non-zero if the conn-stream's endpoint is ready to transmit */
static inline int cs_tx_endp_ready(const struct conn_stream *cs)
{
return (cs->endp->flags & CS_EP_WANT_GET);
}
/* Report that a conn-stream wants to get some data from the output buffer */
static inline void cs_want_get(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_WANT_GET;
}
/* Report that a conn-stream failed to get some data from the output buffer */
static inline void cs_cant_get(struct conn_stream *cs)
{
cs->endp->flags |= CS_EP_WANT_GET | CS_EP_WAIT_DATA;
}
/* Report that a conn-stream doesn't want to get data from the output buffer */
static inline void cs_stop_get(struct conn_stream *cs)
{
cs->endp->flags &= ~CS_EP_WANT_GET;
}
/* Report that a conn-stream won't get any more data from the output buffer */
static inline void cs_done_get(struct conn_stream *cs)
{
cs->endp->flags &= ~(CS_EP_WANT_GET | CS_EP_WAIT_DATA);
}
#endif /* _HAPROXY_STREAM_INTERFACE_H */
/*