linux/include/net/strparser.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Stream Parser
 *
 * Copyright (c) 2016 Tom Herbert <[email protected]>
 */

#ifndef __NET_STRPARSER_H_
#define __NET_STRPARSER_H_

#include <linux/skbuff.h>
#include <net/sock.h>

#define STRP_STATS_ADD(stat, count)
#define STRP_STATS_INCR(stat)

struct strp_stats {};

struct strp_aggr_stats {};

struct strparser;

/* Callbacks are called with lock held for the attached socket */
struct strp_callbacks {};

struct strp_msg {};

struct _strp_msg {};

struct sk_skb_cb {};

static inline struct strp_msg *strp_msg(struct sk_buff *skb)
{}

/* Structure for an attached lower socket */
struct strparser {};

/* Must be called with lock held for attached socket */
static inline void strp_pause(struct strparser *strp)
{}

/* May be called without holding lock for attached socket */
void strp_unpause(struct strparser *strp);
/* Must be called with process lock held (lock_sock) */
void __strp_unpause(struct strparser *strp);

static inline void save_strp_stats(struct strparser *strp,
				   struct strp_aggr_stats *agg_stats)
{}

static inline void aggregate_strp_stats(struct strp_aggr_stats *stats,
					struct strp_aggr_stats *agg_stats)
{}

void strp_done(struct strparser *strp);
void strp_stop(struct strparser *strp);
void strp_check_rcv(struct strparser *strp);
int strp_init(struct strparser *strp, struct sock *sk,
	      const struct strp_callbacks *cb);
void strp_data_ready(struct strparser *strp);
int strp_process(struct strparser *strp, struct sk_buff *orig_skb,
		 unsigned int orig_offset, size_t orig_len,
		 size_t max_msg_size, long timeo);

#endif /* __NET_STRPARSER_H_ */