linux/include/net/llc_pdu.h

#ifndef LLC_PDU_H
#define LLC_PDU_H
/*
 * Copyright (c) 1997 by Procom Technology,Inc.
 * 		 2001-2003 by Arnaldo Carvalho de Melo <[email protected]>
 *
 * This program can be redistributed or modified under the terms of the
 * GNU General Public License as published by the Free Software Foundation.
 * This program is distributed without any warranty or implied warranty
 * of merchantability or fitness for a particular purpose.
 *
 * See the GNU General Public License for more details.
 */

#include <linux/if_ether.h>

/* Lengths of frame formats */
#define LLC_PDU_LEN_I
#define LLC_PDU_LEN_S
#define LLC_PDU_LEN_U
/* header and 1 control byte and XID info */
#define LLC_PDU_LEN_U_XID
/* Known SAP addresses */
#define LLC_GLOBAL_SAP
#define LLC_NULL_SAP
#define LLC_MGMT_INDIV
#define LLC_MGMT_GRP
#define LLC_RDE_SAP

/* SAP field bit masks */
#define LLC_ISO_RESERVED_SAP
#define LLC_SAP_GROUP_DSAP
#define LLC_SAP_RESP_SSAP

/* Group/individual DSAP indicator is DSAP field */
#define LLC_PDU_GROUP_DSAP_MASK
#define LLC_PDU_IS_GROUP_DSAP(pdu)
#define LLC_PDU_IS_INDIV_DSAP(pdu)

/* Command/response PDU indicator in SSAP field */
#define LLC_PDU_CMD_RSP_MASK
#define LLC_PDU_CMD
#define LLC_PDU_RSP
#define LLC_PDU_IS_CMD(pdu)
#define LLC_PDU_IS_RSP(pdu)

/* Get PDU type from 2 lowest-order bits of control field first byte */
#define LLC_PDU_TYPE_I_MASK
#define LLC_PDU_TYPE_S_MASK
#define LLC_PDU_TYPE_U_MASK
#define LLC_PDU_TYPE_MASK

#define LLC_PDU_TYPE_I
#define LLC_PDU_TYPE_S
#define LLC_PDU_TYPE_U
#define LLC_PDU_TYPE_U_XID

#define LLC_PDU_TYPE_IS_I(pdu)

#define LLC_PDU_TYPE_IS_U(pdu)

#define LLC_PDU_TYPE_IS_S(pdu)

/* U-format PDU control field masks */
#define LLC_U_PF_BIT_MASK
#define LLC_U_PF_IS_1(pdu)
#define LLC_U_PF_IS_0(pdu)

#define LLC_U_PDU_CMD_MASK
#define LLC_U_PDU_CMD(pdu)
#define LLC_U_PDU_RSP(pdu)

#define LLC_1_PDU_CMD_UI
#define LLC_1_PDU_CMD_XID
#define LLC_1_PDU_CMD_TEST

#define LLC_2_PDU_CMD_SABME
#define LLC_2_PDU_CMD_DISC
#define LLC_2_PDU_RSP_UA
#define LLC_2_PDU_RSP_DM
#define LLC_2_PDU_RSP_FRMR

/* Type 1 operations */

/* XID information field bit masks */

/* LLC format identifier (byte 1) */
#define LLC_XID_FMT_ID

/* LLC types/classes identifier (byte 2) */
#define LLC_XID_CLASS_ZEROS_MASK
#define LLC_XID_CLASS_MASK

#define LLC_XID_NULL_CLASS_1
#define LLC_XID_NULL_CLASS_2
#define LLC_XID_NULL_CLASS_3
#define LLC_XID_NULL_CLASS_4

#define LLC_XID_NNULL_TYPE_1
#define LLC_XID_NNULL_TYPE_2
#define LLC_XID_NNULL_TYPE_3
#define LLC_XID_NNULL_TYPE_1_2
#define LLC_XID_NNULL_TYPE_1_3
#define LLC_XID_NNULL_TYPE_2_3
#define LLC_XID_NNULL_ALL

/* Sender Receive Window (byte 3) */
#define LLC_XID_RW_MASK

#define LLC_XID_MIN_RW

/* Type 2 operations */

#define LLC_2_SEQ_NBR_MODULO

/* I-PDU masks ('ctrl' is I-PDU control word) */
#define LLC_I_GET_NS(pdu)
#define LLC_I_GET_NR(pdu)

#define LLC_I_PF_BIT_MASK

#define LLC_I_PF_IS_0(pdu)
#define LLC_I_PF_IS_1(pdu)

/* S-PDU supervisory commands and responses */

#define LLC_S_PDU_CMD_MASK
#define LLC_S_PDU_CMD(pdu)
#define LLC_S_PDU_RSP(pdu)

#define LLC_2_PDU_CMD_RR
#define LLC_2_PDU_RSP_RR
#define LLC_2_PDU_CMD_REJ
#define LLC_2_PDU_RSP_REJ
#define LLC_2_PDU_CMD_RNR
#define LLC_2_PDU_RSP_RNR

#define LLC_S_PF_BIT_MASK
#define LLC_S_PF_IS_0(pdu)
#define LLC_S_PF_IS_1(pdu)

#define PDU_SUPV_GET_Nr(pdu)
#define PDU_GET_NEXT_Vr(sn)

/* FRMR information field macros */

#define FRMR_INFO_LENGTH

/*
 * info is pointer to FRMR info field structure; 'rej_ctrl' is byte pointer
 * (if U-PDU) or word pointer to rejected PDU control field
 */
#define FRMR_INFO_SET_REJ_CNTRL(info,rej_ctrl)

/*
 * Info is pointer to FRMR info field structure; 'vs' is a byte containing
 * send state variable value in low-order 7 bits (insure the lowest-order
 * bit remains zero (0))
 */
#define FRMR_INFO_SET_Vs(info,vs)
#define FRMR_INFO_SET_Vr(info,vr)

/*
 * Info is pointer to FRMR info field structure; 'cr' is a byte containing
 * the C/R bit value in the low-order bit
 */
#define FRMR_INFO_SET_C_R_BIT(info, cr)

/*
 * In the remaining five macros, 'info' is pointer to FRMR info field
 * structure; 'ind' is a byte containing the bit value to set in the
 * lowest-order bit)
 */
#define FRMR_INFO_SET_INVALID_PDU_CTRL_IND(info, ind)

#define FRMR_INFO_SET_INVALID_PDU_INFO_IND(info, ind)

#define FRMR_INFO_SET_PDU_INFO_2LONG_IND(info, ind)

#define FRMR_INFO_SET_PDU_INVALID_Nr_IND(info, ind)

#define FRMR_INFO_SET_PDU_INVALID_Ns_IND(info, ind)

/* Sequence-numbered PDU format (4 bytes in length) */
struct llc_pdu_sn {} __packed;

static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
{}

/* Un-numbered PDU format (3 bytes in length) */
struct llc_pdu_un {} __packed;

static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
{}

/**
 *	llc_pdu_header_init - initializes pdu header
 *	@skb: input skb that header must be set into it.
 *	@type: type of PDU (U, I or S).
 *	@ssap: source sap.
 *	@dsap: destination sap.
 *	@cr: command/response bit (0 or 1).
 *
 *	This function sets DSAP, SSAP and command/Response bit in LLC header.
 */
static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
				       u8 ssap, u8 dsap, u8 cr)
{}

/**
 *	llc_pdu_decode_sa - extracs source address (MAC) of input frame
 *	@skb: input skb that source address must be extracted from it.
 *	@sa: pointer to source address (6 byte array).
 *
 *	This function extracts source address(MAC) of input frame.
 */
static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
{}

/**
 *	llc_pdu_decode_da - extracts dest address of input frame
 *	@skb: input skb that destination address must be extracted from it
 *	@da: pointer to destination address (6 byte array).
 *
 *	This function extracts destination address(MAC) of input frame.
 */
static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
{}

/**
 *	llc_pdu_decode_ssap - extracts source SAP of input frame
 *	@skb: input skb that source SAP must be extracted from it.
 *	@ssap: source SAP (output argument).
 *
 *	This function extracts source SAP of input frame. Right bit of SSAP is
 *	command/response bit.
 */
static inline void llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
{}

/**
 *	llc_pdu_decode_dsap - extracts dest SAP of input frame
 *	@skb: input skb that destination SAP must be extracted from it.
 *	@dsap: destination SAP (output argument).
 *
 *	This function extracts destination SAP of input frame. right bit of
 *	DSAP designates individual/group SAP.
 */
static inline void llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap)
{}

/**
 *	llc_pdu_init_as_ui_cmd - sets LLC header as UI PDU
 *	@skb: input skb that header must be set into it.
 *
 *	This function sets third byte of LLC header as a UI PDU.
 */
static inline void llc_pdu_init_as_ui_cmd(struct sk_buff *skb)
{}

/**
 *	llc_pdu_init_as_test_cmd - sets PDU as TEST
 *	@skb: Address of the skb to build
 *
 * 	Sets a PDU as TEST
 */
static inline void llc_pdu_init_as_test_cmd(struct sk_buff *skb)
{}

/**
 *	llc_pdu_init_as_test_rsp - build TEST response PDU
 *	@skb: Address of the skb to build
 *	@ev_skb: The received TEST command PDU frame
 *
 *	Builds a pdu frame as a TEST response.
 */
static inline void llc_pdu_init_as_test_rsp(struct sk_buff *skb,
					    struct sk_buff *ev_skb)
{}

/* LLC Type 1 XID command/response information fields format */
struct llc_xid_info {} __packed;

/**
 *	llc_pdu_init_as_xid_cmd - sets bytes 3, 4 & 5 of LLC header as XID
 *	@skb: input skb that header must be set into it.
 *	@svcs_supported: The class of the LLC (I or II)
 *	@rx_window: The size of the receive window of the LLC
 *
 *	This function sets third,fourth,fifth and sixth bytes of LLC header as
 *	a XID PDU.
 */
static inline void llc_pdu_init_as_xid_cmd(struct sk_buff *skb,
					   u8 svcs_supported, u8 rx_window)
{}

/**
 *	llc_pdu_init_as_xid_rsp - builds XID response PDU
 *	@skb: Address of the skb to build
 *	@svcs_supported: The class of the LLC (I or II)
 *	@rx_window: The size of the receive window of the LLC
 *
 *	Builds a pdu frame as an XID response.
 */
static inline void llc_pdu_init_as_xid_rsp(struct sk_buff *skb,
					   u8 svcs_supported, u8 rx_window)
{}

/* LLC Type 2 FRMR response information field format */
struct llc_frmr_info {} __packed;

void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);
void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit);
void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit);
void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr);
void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit);
void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit);
void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
			      u8 f_bit, u8 vs, u8 vr, u8 vzyxw);
void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
#endif /* LLC_PDU_H */