linux/include/net/cfg802154.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2007, 2008, 2009 Siemens AG
 *
 * Written by:
 * Dmitry Eremin-Solenikov <[email protected]>
 */

#ifndef __NET_CFG802154_H
#define __NET_CFG802154_H

#include <linux/ieee802154.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/bug.h>

#include <net/nl802154.h>

struct wpan_phy;
struct wpan_phy_cca;
struct cfg802154_scan_request;
struct cfg802154_beacon_request;
struct ieee802154_addr;

#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
struct ieee802154_llsec_device_key;
struct ieee802154_llsec_seclevel;
struct ieee802154_llsec_params;
struct ieee802154_llsec_device;
struct ieee802154_llsec_table;
struct ieee802154_llsec_key_id;
struct ieee802154_llsec_key;
#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */

struct cfg802154_ops {};

static inline bool
wpan_phy_supported_bool(bool b, enum nl802154_supported_bool_states st)
{}

struct wpan_phy_supported {};

struct wpan_phy_cca {};

static inline bool
wpan_phy_cca_cmp(const struct wpan_phy_cca *a, const struct wpan_phy_cca *b)
{}

/**
 * enum wpan_phy_flags - WPAN PHY state flags
 * @WPAN_PHY_FLAG_TXPOWER: Indicates that transceiver will support
 *	transmit power setting.
 * @WPAN_PHY_FLAG_CCA_ED_LEVEL: Indicates that transceiver will support cca ed
 *	level setting.
 * @WPAN_PHY_FLAG_CCA_MODE: Indicates that transceiver will support cca mode
 *	setting.
 * @WPAN_PHY_FLAG_STATE_QUEUE_STOPPED: Indicates that the transmit queue was
 *	temporarily stopped.
 * @WPAN_PHY_FLAG_DATAGRAMS_ONLY: Indicates that transceiver is only able to
 *	send/receive datagrams.
 */
enum wpan_phy_flags {};

struct wpan_phy {};

static inline struct net *wpan_phy_net(struct wpan_phy *wpan_phy)
{}

static inline void wpan_phy_net_set(struct wpan_phy *wpan_phy, struct net *net)
{}

static inline bool ieee802154_chan_is_valid(struct wpan_phy *phy,
					    u8 page, u8 channel)
{}

/**
 * struct ieee802154_addr - IEEE802.15.4 device address
 * @mode: Address mode from frame header. Can be one of:
 *        - @IEEE802154_ADDR_NONE
 *        - @IEEE802154_ADDR_SHORT
 *        - @IEEE802154_ADDR_LONG
 * @pan_id: The PAN ID this address belongs to
 * @short_addr: address if @mode is @IEEE802154_ADDR_SHORT
 * @extended_addr: address if @mode is @IEEE802154_ADDR_LONG
 */
struct ieee802154_addr {};

/**
 * struct ieee802154_coord_desc - Coordinator descriptor
 * @addr: PAN ID and coordinator address
 * @page: page this coordinator is using
 * @channel: channel this coordinator is using
 * @superframe_spec: SuperFrame specification as received
 * @link_quality: link quality indicator at which the beacon was received
 * @gts_permit: the coordinator accepts GTS requests
 */
struct ieee802154_coord_desc {};

/**
 * struct ieee802154_pan_device - PAN device information
 * @pan_id: the PAN ID of this device
 * @mode: the preferred mode to reach the device
 * @short_addr: the short address of this device
 * @extended_addr: the extended address of this device
 * @node: the list node
 */
struct ieee802154_pan_device {};

/**
 * struct cfg802154_scan_request - Scan request
 *
 * @type: type of scan to be performed
 * @page: page on which to perform the scan
 * @channels: channels in te %page to be scanned
 * @duration: time spent on each channel, calculated with:
 *            aBaseSuperframeDuration * (2 ^ duration + 1)
 * @wpan_dev: the wpan device on which to perform the scan
 * @wpan_phy: the wpan phy on which to perform the scan
 */
struct cfg802154_scan_request {};

/**
 * struct cfg802154_beacon_request - Beacon request descriptor
 *
 * @interval: interval n between sendings, in multiple order of the super frame
 *            duration: aBaseSuperframeDuration * (2^n) unless the interval
 *            order is greater or equal to 15, in this case beacons won't be
 *            passively sent out at a fixed rate but instead inform the device
 *            that it should answer beacon requests as part of active scan
 *            procedures
 * @wpan_dev: the concerned wpan device
 * @wpan_phy: the wpan phy this was for
 */
struct cfg802154_beacon_request {};

/**
 * struct cfg802154_mac_pkt - MAC packet descriptor (beacon/command)
 * @node: MAC packets to process list member
 * @skb: the received sk_buff
 * @sdata: the interface on which @skb was received
 * @page: page configuration when @skb was received
 * @channel: channel configuration when @skb was received
 */
struct cfg802154_mac_pkt {};

struct ieee802154_llsec_key_id {};

#define IEEE802154_LLSEC_KEY_SIZE

struct ieee802154_llsec_key {};

struct ieee802154_llsec_key_entry {};

struct ieee802154_llsec_params {};

struct ieee802154_llsec_table {};

struct ieee802154_llsec_seclevel {};

struct ieee802154_llsec_device {};

struct ieee802154_llsec_device_key {};

struct wpan_dev_header_ops {};

struct wpan_dev {};

#define to_phy(_dev)

#if IS_ENABLED(CONFIG_IEEE802154) || IS_ENABLED(CONFIG_6LOWPAN)
static inline int
wpan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
		     const struct ieee802154_addr *daddr,
		     const struct ieee802154_addr *saddr,
		     unsigned int len)
{}
#endif

struct wpan_phy *
wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size);
static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
{}

int wpan_phy_register(struct wpan_phy *phy);
void wpan_phy_unregister(struct wpan_phy *phy);
void wpan_phy_free(struct wpan_phy *phy);
/* Same semantics as for class_for_each_device */
int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);

static inline void *wpan_phy_priv(struct wpan_phy *phy)
{}

struct wpan_phy *wpan_phy_find(const char *str);

static inline void wpan_phy_put(struct wpan_phy *phy)
{}

static inline const char *wpan_phy_name(struct wpan_phy *phy)
{}

void ieee802154_configure_durations(struct wpan_phy *phy,
				    unsigned int page, unsigned int channel);

/**
 * cfg802154_device_is_associated - Checks whether we are associated to any device
 * @wpan_dev: the wpan device
 * @return: true if we are associated
 */
bool cfg802154_device_is_associated(struct wpan_dev *wpan_dev);

/**
 * cfg802154_device_is_parent - Checks if a device is our coordinator
 * @wpan_dev: the wpan device
 * @target: the expected parent
 * @return: true if @target is our coordinator
 */
bool cfg802154_device_is_parent(struct wpan_dev *wpan_dev,
				struct ieee802154_addr *target);

/**
 * cfg802154_device_is_child - Checks whether a device is associated to us
 * @wpan_dev: the wpan device
 * @target: the expected child
 * @return: the PAN device
 */
struct ieee802154_pan_device *
cfg802154_device_is_child(struct wpan_dev *wpan_dev,
			  struct ieee802154_addr *target);

/**
 * cfg802154_set_max_associations - Limit the number of future associations
 * @wpan_dev: the wpan device
 * @max: the maximum number of devices we accept to associate
 * @return: the old maximum value
 */
unsigned int cfg802154_set_max_associations(struct wpan_dev *wpan_dev,
					    unsigned int max);

/**
 * cfg802154_get_free_short_addr - Get a free address among the known devices
 * @wpan_dev: the wpan device
 * @return: a random short address expectedly unused on our PAN
 */
__le16 cfg802154_get_free_short_addr(struct wpan_dev *wpan_dev);

#endif /* __NET_CFG802154_H */