linux/net/nfc/llcp.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2011  Intel Corporation. All rights reserved.
 */

enum llcp_state {};

#define LLCP_DEFAULT_LTO
#define LLCP_DEFAULT_RW
#define LLCP_DEFAULT_MIU

#define LLCP_MAX_LTO
#define LLCP_MAX_RW
#define LLCP_MAX_MIUX
#define LLCP_MAX_MIU

#define LLCP_WKS_NUM_SAP
#define LLCP_SDP_NUM_SAP
#define LLCP_LOCAL_NUM_SAP
#define LLCP_LOCAL_SAP_OFFSET
#define LLCP_MAX_SAP
#define LLCP_SDP_UNBOUND

struct nfc_llcp_sock;

struct llcp_sock_list {};

struct nfc_llcp_sdp_tlv {};

struct nfc_llcp_local {};

struct nfc_llcp_sock {};

struct nfc_llcp_ui_cb {};

#define nfc_llcp_ui_skb_cb(__skb)

#define nfc_llcp_sock(sk)
#define nfc_llcp_dev(sk)

#define LLCP_HEADER_SIZE
#define LLCP_SEQUENCE_SIZE
#define LLCP_AGF_PDU_HEADER_SIZE

/* LLCP versions: 1.1 is 1.0 plus SDP */
#define LLCP_VERSION_10
#define LLCP_VERSION_11

/* LLCP PDU types */
#define LLCP_PDU_SYMM
#define LLCP_PDU_PAX
#define LLCP_PDU_AGF
#define LLCP_PDU_UI
#define LLCP_PDU_CONNECT
#define LLCP_PDU_DISC
#define LLCP_PDU_CC
#define LLCP_PDU_DM
#define LLCP_PDU_FRMR
#define LLCP_PDU_SNL
#define LLCP_PDU_I
#define LLCP_PDU_RR
#define LLCP_PDU_RNR

/* Parameters TLV types */
#define LLCP_TLV_VERSION
#define LLCP_TLV_MIUX
#define LLCP_TLV_WKS
#define LLCP_TLV_LTO
#define LLCP_TLV_RW
#define LLCP_TLV_SN
#define LLCP_TLV_OPT
#define LLCP_TLV_SDREQ
#define LLCP_TLV_SDRES
#define LLCP_TLV_MAX

/* Well known LLCP SAP */
#define LLCP_SAP_SDP
#define LLCP_SAP_IP
#define LLCP_SAP_OBEX
#define LLCP_SAP_SNEP
#define LLCP_SAP_MAX

/* Disconnection reason code */
#define LLCP_DM_DISC
#define LLCP_DM_NOCONN
#define LLCP_DM_NOBOUND
#define LLCP_DM_REJ


void nfc_llcp_sock_link(struct llcp_sock_list *l, struct sock *s);
void nfc_llcp_sock_unlink(struct llcp_sock_list *l, struct sock *s);
void nfc_llcp_socket_remote_param_init(struct nfc_llcp_sock *sock);
struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev);
int nfc_llcp_local_put(struct nfc_llcp_local *local);
u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
			 struct nfc_llcp_sock *sock);
u8 nfc_llcp_get_local_ssap(struct nfc_llcp_local *local);
void nfc_llcp_put_ssap(struct nfc_llcp_local *local, u8 ssap);
int nfc_llcp_queue_i_frames(struct nfc_llcp_sock *sock);
void nfc_llcp_send_to_raw_sock(struct nfc_llcp_local *local,
			       struct sk_buff *skb, u8 direction);

/* Sock API */
struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp, int kern);
void nfc_llcp_sock_free(struct nfc_llcp_sock *sock);
void nfc_llcp_accept_unlink(struct sock *sk);
void nfc_llcp_accept_enqueue(struct sock *parent, struct sock *sk);
struct sock *nfc_llcp_accept_dequeue(struct sock *sk, struct socket *newsock);

/* TLV API */
int nfc_llcp_parse_gb_tlv(struct nfc_llcp_local *local,
			  const u8 *tlv_array, u16 tlv_array_len);
int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
				  const u8 *tlv_array, u16 tlv_array_len);

/* Commands API */
void nfc_llcp_recv(void *data, struct sk_buff *skb, int err);
u8 *nfc_llcp_build_tlv(u8 type, const u8 *value, u8 value_length, u8 *tlv_length);
struct nfc_llcp_sdp_tlv *nfc_llcp_build_sdres_tlv(u8 tid, u8 sap);
struct nfc_llcp_sdp_tlv *nfc_llcp_build_sdreq_tlv(u8 tid, const char *uri,
						  size_t uri_len);
void nfc_llcp_free_sdp_tlv(struct nfc_llcp_sdp_tlv *sdp);
void nfc_llcp_free_sdp_tlv_list(struct hlist_head *sdp_head);
void nfc_llcp_recv(void *data, struct sk_buff *skb, int err);
int nfc_llcp_send_symm(struct nfc_dev *dev);
int nfc_llcp_send_connect(struct nfc_llcp_sock *sock);
int nfc_llcp_send_cc(struct nfc_llcp_sock *sock);
int nfc_llcp_send_snl_sdres(struct nfc_llcp_local *local,
			    struct hlist_head *tlv_list, size_t tlvs_len);
int nfc_llcp_send_snl_sdreq(struct nfc_llcp_local *local,
			    struct hlist_head *tlv_list, size_t tlvs_len);
int nfc_llcp_send_dm(struct nfc_llcp_local *local, u8 ssap, u8 dsap, u8 reason);
int nfc_llcp_send_disconnect(struct nfc_llcp_sock *sock);
int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
			  struct msghdr *msg, size_t len);
int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap,
			   struct msghdr *msg, size_t len);
int nfc_llcp_send_rr(struct nfc_llcp_sock *sock);

/* Socket API */
int __init nfc_llcp_sock_init(void);
void nfc_llcp_sock_exit(void);