linux/net/batman-adv/main.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) B.A.T.M.A.N. contributors:
 *
 * Marek Lindner, Simon Wunderlich
 */

#ifndef _NET_BATMAN_ADV_MAIN_H_
#define _NET_BATMAN_ADV_MAIN_H_

#define BATADV_DRIVER_AUTHOR
#define BATADV_DRIVER_DESC
#define BATADV_DRIVER_DEVICE

#ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION
#endif

/* B.A.T.M.A.N. parameters */

#define BATADV_TQ_MAX_VALUE
#define BATADV_THROUGHPUT_MAX_VALUE
#define BATADV_JITTER

/* Time To Live of broadcast messages */
#define BATADV_TTL

/* maximum sequence number age of broadcast messages */
#define BATADV_BCAST_MAX_AGE

/* purge originators after time in seconds if no valid packet comes in
 * -> TODO: check influence on BATADV_TQ_LOCAL_WINDOW_SIZE
 */
#define BATADV_PURGE_TIMEOUT
#define BATADV_TT_LOCAL_TIMEOUT
#define BATADV_TT_CLIENT_ROAM_TIMEOUT
#define BATADV_TT_CLIENT_TEMP_TIMEOUT
#define BATADV_TT_WORK_PERIOD
#define BATADV_ORIG_WORK_PERIOD
#define BATADV_MCAST_WORK_PERIOD
#define BATADV_DAT_ENTRY_TIMEOUT
/* sliding packet range of received originator messages in sequence numbers
 * (should be a multiple of our word size)
 */
#define BATADV_TQ_LOCAL_WINDOW_SIZE
/* milliseconds we have to keep pending tt_req */
#define BATADV_TT_REQUEST_TIMEOUT

#define BATADV_TQ_GLOBAL_WINDOW_SIZE
#define BATADV_TQ_LOCAL_BIDRECT_SEND_MINIMUM
#define BATADV_TQ_LOCAL_BIDRECT_RECV_MINIMUM
#define BATADV_TQ_TOTAL_BIDRECT_LIMIT

/* B.A.T.M.A.N. V */
#define BATADV_THROUGHPUT_DEFAULT_VALUE
#define BATADV_ELP_PROBES_PER_NODE
#define BATADV_ELP_MIN_PROBE_SIZE
#define BATADV_ELP_PROBE_MAX_TX_DIFF
#define BATADV_ELP_MAX_AGE
#define BATADV_OGM_MAX_ORIGDIFF
#define BATADV_OGM_MAX_AGE

/* number of OGMs sent with the last tt diff */
#define BATADV_TT_OGM_APPEND_MAX

/* Time in which a client can roam at most ROAMING_MAX_COUNT times in
 * milliseconds
 */
#define BATADV_ROAMING_MAX_TIME
#define BATADV_ROAMING_MAX_COUNT

#define BATADV_NO_FLAGS

#define BATADV_NULL_IFINDEX

#define BATADV_NO_MARK

/* default interface for multi interface operation. The default interface is
 * used for communication which originated locally (i.e. is not forwarded)
 * or where special forwarding is not desired/necessary.
 */
#define BATADV_IF_DEFAULT

#define BATADV_NUM_WORDS

#define BATADV_LOG_BUF_LEN

/* number of packets to send for broadcasts on different interface types */
#define BATADV_NUM_BCASTS_DEFAULT
#define BATADV_NUM_BCASTS_WIRELESS

/* length of the single packet used by the TP meter */
#define BATADV_TP_PACKET_LEN

/* msecs after which an ARP_REQUEST is sent in broadcast as fallback */
#define ARP_REQ_DELAY
/* numbers of originator to contact for any PUT/GET DHT operation */
#define BATADV_DAT_CANDIDATES_NUM

/* BATADV_TQ_SIMILARITY_THRESHOLD - TQ points that a secondary metric can differ
 * at most from the primary one in order to be still considered acceptable
 */
#define BATADV_TQ_SIMILARITY_THRESHOLD

/* should not be bigger than 512 bytes or change the size of
 * forw_packet->direct_link_flags
 */
#define BATADV_MAX_AGGREGATION_BYTES
#define BATADV_MAX_AGGREGATION_MS

#define BATADV_BLA_PERIOD_LENGTH
#define BATADV_BLA_BACKBONE_TIMEOUT
#define BATADV_BLA_CLAIM_TIMEOUT
#define BATADV_BLA_WAIT_PERIODS
#define BATADV_BLA_LOOPDETECT_PERIODS
#define BATADV_BLA_LOOPDETECT_TIMEOUT

#define BATADV_DUPLIST_SIZE
#define BATADV_DUPLIST_TIMEOUT
/* don't reset again within 30 seconds */
#define BATADV_RESET_PROTECTION_MS
#define BATADV_EXPECTED_SEQNO_RANGE

#define BATADV_NC_NODE_TIMEOUT

/**
 * BATADV_TP_MAX_NUM - maximum number of simultaneously active tp sessions
 */
#define BATADV_TP_MAX_NUM

/**
 * enum batadv_mesh_state - State of a soft interface
 */
enum batadv_mesh_state {};

#define BATADV_BCAST_QUEUE_LEN
#define BATADV_BATMAN_QUEUE_LEN

/**
 * enum batadv_uev_action - action type of uevent
 */
enum batadv_uev_action {};

/**
 * enum batadv_uev_type - Type of uevent
 */
enum batadv_uev_type {};

#define BATADV_GW_THRESHOLD

/* Number of fragment chains for each orig_node */
#define BATADV_FRAG_BUFFER_COUNT
/* Maximum number of fragments for one packet */
#define BATADV_FRAG_MAX_FRAGMENTS
/* Maxumim size of each fragment */
#define BATADV_FRAG_MAX_FRAG_SIZE
/* Time to keep fragments while waiting for rest of the fragments */
#define BATADV_FRAG_TIMEOUT

#define BATADV_DAT_CANDIDATE_NOT_FOUND
#define BATADV_DAT_CANDIDATE_ORIG

/* Debug Messages */
#ifdef pr_fmt
#undef pr_fmt
#endif
/* Append 'batman-adv: ' before kernel messages */
#define pr_fmt(fmt)

/* Kernel headers */

#include <linux/atomic.h>
#include <linux/compiler.h>
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/jiffies.h>
#include <linux/netdevice.h>
#include <linux/percpu.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <uapi/linux/batadv_packet.h>

#include "types.h"
#include "main.h"

/**
 * batadv_print_vid() - return printable version of vid information
 * @vid: the VLAN identifier
 *
 * Return: -1 when no VLAN is used, VLAN id otherwise
 */
static inline int batadv_print_vid(unsigned short vid)
{}

extern struct list_head batadv_hardif_list;
extern unsigned int batadv_hardif_generation;

extern unsigned char batadv_broadcast_addr[];
extern struct workqueue_struct *batadv_event_workqueue;

int batadv_mesh_init(struct net_device *soft_iface);
void batadv_mesh_free(struct net_device *soft_iface);
bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr);
int batadv_max_header_len(void);
void batadv_skb_set_priority(struct sk_buff *skb, int offset);
int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
			   struct packet_type *ptype,
			   struct net_device *orig_dev);
int
batadv_recv_handler_register(u8 packet_type,
			     int (*recv_handler)(struct sk_buff *,
						 struct batadv_hard_iface *));
void batadv_recv_handler_unregister(u8 packet_type);
__be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr);

/**
 * batadv_compare_eth() - Compare two not u16 aligned Ethernet addresses
 * @data1: Pointer to a six-byte array containing the Ethernet address
 * @data2: Pointer other six-byte array containing the Ethernet address
 *
 * note: can't use ether_addr_equal() as it requires aligned memory
 *
 * Return: true if they are the same ethernet addr
 */
static inline bool batadv_compare_eth(const void *data1, const void *data2)
{}

/**
 * batadv_has_timed_out() - compares current time (jiffies) and timestamp +
 *  timeout
 * @timestamp:		base value to compare with (in jiffies)
 * @timeout:		added to base value before comparing (in milliseconds)
 *
 * Return: true if current time is after timestamp + timeout
 */
static inline bool batadv_has_timed_out(unsigned long timestamp,
					unsigned int timeout)
{}

/**
 * batadv_atomic_dec_not_zero() - Decrease unless the number is 0
 * @v: pointer of type atomic_t
 *
 * Return: non-zero if v was not 0, and zero otherwise.
 */
#define batadv_atomic_dec_not_zero(v)

/**
 * batadv_smallest_signed_int() - Returns the smallest signed integer in two's
 *  complement with the sizeof x
 * @x: type of integer
 *
 * Return: smallest signed integer of type
 */
#define batadv_smallest_signed_int(x)

/**
 * batadv_seq_before() - Checks if a sequence number x is a predecessor of y
 * @x: potential predecessor of @y
 * @y: value to compare @x against
 *
 * It handles overflows/underflows and can correctly check for a predecessor
 * unless the variable sequence number has grown by more than
 * 2**(bitwidth(x)-1)-1.
 *
 * This means that for a u8 with the maximum value 255, it would think:
 *
 * * when adding nothing - it is neither a predecessor nor a successor
 * * before adding more than 127 to the starting value - it is a predecessor,
 * * when adding 128 - it is neither a predecessor nor a successor,
 * * after adding more than 127 to the starting value - it is a successor
 *
 * Return: true when x is a predecessor of y, false otherwise
 */
#define batadv_seq_before(x, y)

/**
 * batadv_seq_after() - Checks if a sequence number x is a successor of y
 * @x: potential successor of @y
 * @y: value to compare @x against
 *
 * It handles overflows/underflows and can correctly check for a successor
 * unless the variable sequence number has grown by more than
 * 2**(bitwidth(x)-1)-1.
 *
 * This means that for a u8 with the maximum value 255, it would think:
 *
 * * when adding nothing - it is neither a predecessor nor a successor
 * * before adding more than 127 to the starting value - it is a predecessor,
 * * when adding 128 - it is neither a predecessor nor a successor,
 * * after adding more than 127 to the starting value - it is a successor
 *
 * Return: true when x is a successor of y, false otherwise
 */
#define batadv_seq_after(x, y)

/**
 * batadv_add_counter() - Add to per cpu statistics counter of soft interface
 * @bat_priv: the bat priv with all the soft interface information
 * @idx: counter index which should be modified
 * @count: value to increase counter by
 *
 * Stop preemption on local cpu while incrementing the counter
 */
static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
				      size_t count)
{}

/**
 * batadv_inc_counter() - Increase per cpu statistics counter of soft interface
 * @b: the bat priv with all the soft interface information
 * @i: counter index which should be modified
 */
#define batadv_inc_counter(b, i)

/**
 * BATADV_SKB_CB() - Get batadv_skb_cb from skb control buffer
 * @__skb: skb holding the control buffer
 *
 * The members of the control buffer are defined in struct batadv_skb_cb in
 * types.h. The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h.
 *
 * Return: pointer to the batadv_skb_cb of the skb
 */
#define BATADV_SKB_CB(__skb)

unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len);
bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid);
int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type,
			enum batadv_uev_action action, const char *data);

#endif /* _NET_BATMAN_ADV_MAIN_H_ */