linux/include/net/inet_sock.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * INET		An implementation of the TCP/IP protocol suite for the LINUX
 *		operating system.  INET is implemented using the  BSD Socket
 *		interface as the means of communication with the user level.
 *
 *		Definitions for inet_sock
 *
 * Authors:	Many, reorganised here by
 * 		Arnaldo Carvalho de Melo <[email protected]>
 */
#ifndef _INET_SOCK_H
#define _INET_SOCK_H

#include <linux/bitops.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/jhash.h>
#include <linux/netdevice.h>

#include <net/flow.h>
#include <net/sock.h>
#include <net/request_sock.h>
#include <net/netns/hash.h>
#include <net/tcp_states.h>
#include <net/l3mdev.h>

/** struct ip_options - IP Options
 *
 * @faddr - Saved first hop address
 * @nexthop - Saved nexthop address in LSRR and SSRR
 * @is_strictroute - Strict source route
 * @srr_is_hit - Packet destination addr was our one
 * @is_changed - IP checksum more not valid
 * @rr_needaddr - Need to record addr of outgoing dev
 * @ts_needtime - Need to record timestamp
 * @ts_needaddr - Need to record addr of outgoing dev
 */
struct ip_options {};

struct ip_options_rcu {};

struct ip_options_data {};

struct inet_request_sock {};

static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
{}

static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb)
{}

static inline int inet_request_bound_dev_if(const struct sock *sk,
					    struct sk_buff *skb)
{}

static inline int inet_sk_bound_l3mdev(const struct sock *sk)
{}

static inline bool inet_bound_dev_eq(bool l3mdev_accept, int bound_dev_if,
				     int dif, int sdif)
{}

static inline bool inet_sk_bound_dev_eq(const struct net *net,
					int bound_dev_if,
					int dif, int sdif)
{}

struct inet_cork {};

struct inet_cork_full {};

struct ip_mc_socklist;
struct ipv6_pinfo;
struct rtable;

/** struct inet_sock - representation of INET sockets
 *
 * @sk - ancestor class
 * @pinet6 - pointer to IPv6 control block
 * @inet_daddr - Foreign IPv4 addr
 * @inet_rcv_saddr - Bound local IPv4 addr
 * @inet_dport - Destination port
 * @inet_num - Local port
 * @inet_flags - various atomic flags
 * @inet_saddr - Sending source
 * @uc_ttl - Unicast TTL
 * @inet_sport - Source port
 * @inet_id - ID counter for DF pkts
 * @tos - TOS
 * @mc_ttl - Multicasting TTL
 * @uc_index - Unicast outgoing device index
 * @mc_index - Multicast device index
 * @mc_list - Group array
 * @cork - info to build ip hdr on each ip frag while socket is corked
 */
struct inet_sock {};

#define IPCORK_OPT

enum {};

/* cmsg flags for inet */
#define IP_CMSG_PKTINFO
#define IP_CMSG_TTL
#define IP_CMSG_TOS
#define IP_CMSG_RECVOPTS
#define IP_CMSG_RETOPTS
#define IP_CMSG_PASSSEC
#define IP_CMSG_ORIGDSTADDR
#define IP_CMSG_CHECKSUM
#define IP_CMSG_RECVFRAGSIZE

#define IP_CMSG_ALL

static inline unsigned long inet_cmsg_flags(const struct inet_sock *inet)
{}

#define inet_test_bit(nr, sk)
#define inet_set_bit(nr, sk)
#define inet_clear_bit(nr, sk)
#define inet_assign_bit(nr, sk, val)

/**
 * sk_to_full_sk - Access to a full socket
 * @sk: pointer to a socket
 *
 * SYNACK messages might be attached to request sockets.
 * Some places want to reach the listener in this case.
 */
static inline struct sock *sk_to_full_sk(struct sock *sk)
{}

/* sk_to_full_sk() variant with a const argument */
static inline const struct sock *sk_const_to_full_sk(const struct sock *sk)
{}

static inline struct sock *skb_to_full_sk(const struct sk_buff *skb)
{}

#define inet_sk(ptr)

static inline void __inet_sk_copy_descendant(struct sock *sk_to,
					     const struct sock *sk_from,
					     const int ancestor_size)
{}

int inet_sk_rebuild_header(struct sock *sk);

/**
 * inet_sk_state_load - read sk->sk_state for lockless contexts
 * @sk: socket pointer
 *
 * Paired with inet_sk_state_store(). Used in places we don't hold socket lock:
 * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ...
 */
static inline int inet_sk_state_load(const struct sock *sk)
{}

/**
 * inet_sk_state_store - update sk->sk_state
 * @sk: socket pointer
 * @newstate: new state
 *
 * Paired with inet_sk_state_load(). Should be used in contexts where
 * state change might impact lockless readers.
 */
void inet_sk_state_store(struct sock *sk, int newstate);

void inet_sk_set_state(struct sock *sk, int state);

static inline unsigned int __inet_ehashfn(const __be32 laddr,
					  const __u16 lport,
					  const __be32 faddr,
					  const __be16 fport,
					  u32 initval)
{}

struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
				      struct sock *sk_listener,
				      bool attach_listener);

static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
{}

static inline void inet_inc_convert_csum(struct sock *sk)
{}

static inline void inet_dec_convert_csum(struct sock *sk)
{}

static inline bool inet_get_convert_csum(struct sock *sk)
{}


static inline bool inet_can_nonlocal_bind(struct net *net,
					  struct inet_sock *inet)
{}

static inline bool inet_addr_valid_or_nonlocal(struct net *net,
					       struct inet_sock *inet,
					       __be32 addr,
					       int addr_type)
{}

#endif	/* _INET_SOCK_H */