linux/include/linux/ieee802154.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * IEEE802.15.4-2003 specification
 *
 * Copyright (C) 2007, 2008 Siemens AG
 *
 * Written by:
 * Pavel Smolenskiy <[email protected]>
 * Maxim Gorbachyov <[email protected]>
 * Maxim Osipov <[email protected]>
 * Dmitry Eremin-Solenikov <[email protected]>
 * Alexander Smirnov <[email protected]>
 */

#ifndef LINUX_IEEE802154_H
#define LINUX_IEEE802154_H

#include <linux/types.h>
#include <linux/random.h>

#define IEEE802154_MTU
#define IEEE802154_ACK_PSDU_LEN
#define IEEE802154_MIN_PSDU_LEN
#define IEEE802154_FCS_LEN
#define IEEE802154_MAX_AUTH_TAG_LEN
#define IEEE802154_FC_LEN
#define IEEE802154_SEQ_LEN

/*  General MAC frame format:
 *  2 bytes: Frame Control
 *  1 byte:  Sequence Number
 * 20 bytes: Addressing fields
 * 14 bytes: Auxiliary Security Header
 */
#define IEEE802154_MAX_HEADER_LEN
#define IEEE802154_MIN_HEADER_LEN

#define IEEE802154_PAN_ID_BROADCAST
#define IEEE802154_ADDR_SHORT_BROADCAST
#define IEEE802154_ADDR_SHORT_UNSPEC

#define IEEE802154_EXTENDED_ADDR_LEN
#define IEEE802154_SHORT_ADDR_LEN
#define IEEE802154_PAN_ID_LEN

/* Duration in superframe order */
#define IEEE802154_MAX_SCAN_DURATION
#define IEEE802154_ACTIVE_SCAN_DURATION
/* Superframe duration in slots */
#define IEEE802154_SUPERFRAME_PERIOD
/* Various periods expressed in symbols */
#define IEEE802154_SLOT_PERIOD
#define IEEE802154_LIFS_PERIOD
#define IEEE802154_SIFS_PERIOD
#define IEEE802154_MAX_SIFS_FRAME_SIZE

#define IEEE802154_MAX_CHANNEL
#define IEEE802154_MAX_PAGE

#define IEEE802154_FC_TYPE_BEACON
#define IEEE802154_FC_TYPE_DATA
#define IEEE802154_FC_TYPE_ACK
#define IEEE802154_FC_TYPE_MAC_CMD

#define IEEE802154_FC_TYPE_SHIFT
#define IEEE802154_FC_TYPE_MASK
#define IEEE802154_FC_TYPE(x)
#define IEEE802154_FC_SET_TYPE(v, x)

#define IEEE802154_FC_SECEN_SHIFT
#define IEEE802154_FC_SECEN
#define IEEE802154_FC_FRPEND_SHIFT
#define IEEE802154_FC_FRPEND
#define IEEE802154_FC_ACK_REQ_SHIFT
#define IEEE802154_FC_ACK_REQ
#define IEEE802154_FC_INTRA_PAN_SHIFT
#define IEEE802154_FC_INTRA_PAN

#define IEEE802154_FC_SAMODE_SHIFT
#define IEEE802154_FC_SAMODE_MASK
#define IEEE802154_FC_DAMODE_SHIFT
#define IEEE802154_FC_DAMODE_MASK

#define IEEE802154_FC_VERSION_SHIFT
#define IEEE802154_FC_VERSION_MASK
#define IEEE802154_FC_VERSION(x)

#define IEEE802154_FC_SAMODE(x)

#define IEEE802154_FC_DAMODE(x)

#define IEEE802154_SCF_SECLEVEL_MASK
#define IEEE802154_SCF_SECLEVEL_SHIFT
#define IEEE802154_SCF_SECLEVEL(x)
#define IEEE802154_SCF_KEY_ID_MODE_SHIFT
#define IEEE802154_SCF_KEY_ID_MODE_MASK
#define IEEE802154_SCF_KEY_ID_MODE(x)

#define IEEE802154_SCF_KEY_IMPLICIT
#define IEEE802154_SCF_KEY_INDEX
#define IEEE802154_SCF_KEY_SHORT_INDEX
#define IEEE802154_SCF_KEY_HW_INDEX

#define IEEE802154_SCF_SECLEVEL_NONE
#define IEEE802154_SCF_SECLEVEL_MIC32
#define IEEE802154_SCF_SECLEVEL_MIC64
#define IEEE802154_SCF_SECLEVEL_MIC128
#define IEEE802154_SCF_SECLEVEL_ENC
#define IEEE802154_SCF_SECLEVEL_ENC_MIC32
#define IEEE802154_SCF_SECLEVEL_ENC_MIC64
#define IEEE802154_SCF_SECLEVEL_ENC_MIC128

/* MAC footer size */
#define IEEE802154_MFR_SIZE

/* MAC's Command Frames Identifiers */
#define IEEE802154_CMD_ASSOCIATION_REQ
#define IEEE802154_CMD_ASSOCIATION_RESP
#define IEEE802154_CMD_DISASSOCIATION_NOTIFY
#define IEEE802154_CMD_DATA_REQ
#define IEEE802154_CMD_PANID_CONFLICT_NOTIFY
#define IEEE802154_CMD_ORPHAN_NOTIFY
#define IEEE802154_CMD_BEACON_REQ
#define IEEE802154_CMD_COORD_REALIGN_NOTIFY
#define IEEE802154_CMD_GTS_REQ

/*
 * The return values of MAC operations
 */
enum {};

/**
 * enum ieee802154_filtering_level - Filtering levels applicable to a PHY
 *
 * @IEEE802154_FILTERING_NONE: No filtering at all, what is received is
 *	forwarded to the softMAC
 * @IEEE802154_FILTERING_1_FCS: First filtering level, frames with an invalid
 *	FCS should be dropped
 * @IEEE802154_FILTERING_2_PROMISCUOUS: Second filtering level, promiscuous
 *	mode as described in the spec, identical in terms of filtering to the
 *	level one on PHY side, but at the MAC level the frame should be
 *	forwarded to the upper layer directly
 * @IEEE802154_FILTERING_3_SCAN: Third filtering level, scan related, where
 *	only beacons must be processed, all remaining traffic gets dropped
 * @IEEE802154_FILTERING_4_FRAME_FIELDS: Fourth filtering level actually
 *	enforcing the validity of the content of the frame with various checks
 */
enum ieee802154_filtering_level {};

/* frame control handling */
#define IEEE802154_FCTL_FTYPE
#define IEEE802154_FCTL_ACKREQ
#define IEEE802154_FCTL_SECEN
#define IEEE802154_FCTL_INTRA_PAN
#define IEEE802154_FCTL_DADDR
#define IEEE802154_FCTL_SADDR

#define IEEE802154_FTYPE_DATA

#define IEEE802154_FCTL_ADDR_NONE
#define IEEE802154_FCTL_DADDR_SHORT
#define IEEE802154_FCTL_DADDR_EXTENDED
#define IEEE802154_FCTL_SADDR_SHORT
#define IEEE802154_FCTL_SADDR_EXTENDED

/*
 * ieee802154_is_data - check if type is IEEE802154_FTYPE_DATA
 * @fc: frame control bytes in little-endian byteorder
 */
static inline int ieee802154_is_data(__le16 fc)
{}

/**
 * ieee802154_is_secen - check if Security bit is set
 * @fc: frame control bytes in little-endian byteorder
 */
static inline bool ieee802154_is_secen(__le16 fc)
{}

/**
 * ieee802154_is_ackreq - check if acknowledgment request bit is set
 * @fc: frame control bytes in little-endian byteorder
 */
static inline bool ieee802154_is_ackreq(__le16 fc)
{}

/**
 * ieee802154_is_intra_pan - check if intra pan id communication
 * @fc: frame control bytes in little-endian byteorder
 */
static inline bool ieee802154_is_intra_pan(__le16 fc)
{}

/*
 * ieee802154_daddr_mode - get daddr mode from fc
 * @fc: frame control bytes in little-endian byteorder
 */
static inline __le16 ieee802154_daddr_mode(__le16 fc)
{}

/*
 * ieee802154_saddr_mode - get saddr mode from fc
 * @fc: frame control bytes in little-endian byteorder
 */
static inline __le16 ieee802154_saddr_mode(__le16 fc)
{}

/**
 * ieee802154_is_valid_psdu_len - check if psdu len is valid
 * available lengths:
 *	0-4	Reserved
 *	5	MPDU (Acknowledgment)
 *	6-8	Reserved
 *	9-127	MPDU
 *
 * @len: psdu len with (MHR + payload + MFR)
 */
static inline bool ieee802154_is_valid_psdu_len(u8 len)
{}

/**
 * ieee802154_is_valid_extended_unicast_addr - check if extended addr is valid
 * @addr: extended addr to check
 */
static inline bool ieee802154_is_valid_extended_unicast_addr(__le64 addr)
{}

/**
 * ieee802154_is_broadcast_short_addr - check if short addr is broadcast
 * @addr: short addr to check
 */
static inline bool ieee802154_is_broadcast_short_addr(__le16 addr)
{}

/**
 * ieee802154_is_unspec_short_addr - check if short addr is unspecified
 * @addr: short addr to check
 */
static inline bool ieee802154_is_unspec_short_addr(__le16 addr)
{}

/**
 * ieee802154_is_valid_src_short_addr - check if source short address is valid
 * @addr: short addr to check
 */
static inline bool ieee802154_is_valid_src_short_addr(__le16 addr)
{}

/**
 * ieee802154_random_extended_addr - generates a random extended address
 * @addr: extended addr pointer to place the random address
 */
static inline void ieee802154_random_extended_addr(__le64 *addr)
{}

#endif /* LINUX_IEEE802154_H */