NFC: Forbid SSAP binding to a not well known LLCP service
[deliverable/linux.git] / net / nfc / llcp / llcp.h
index 50680ce5ae4396435552936f22cf3a8d17e26a25..374cc4779af4acfb0ab65a5780fc2418b039975d 100644 (file)
@@ -40,12 +40,18 @@ enum llcp_state {
 
 struct nfc_llcp_sock;
 
+struct llcp_sock_list {
+       struct hlist_head head;
+       rwlock_t          lock;
+};
+
 struct nfc_llcp_local {
        struct list_head list;
        struct nfc_dev *dev;
 
+       struct kref ref;
+
        struct mutex sdp_lock;
-       struct mutex socket_lock;
 
        struct timer_list link_timer;
        struct sk_buff_head tx_queue;
@@ -77,24 +83,26 @@ struct nfc_llcp_local {
        u16 remote_lto;
        u8  remote_opt;
        u16 remote_wks;
-       u8  remote_rw;
 
        /* sockets array */
-       struct nfc_llcp_sock *sockets[LLCP_MAX_SAP];
+       struct llcp_sock_list sockets;
+       struct llcp_sock_list connecting_sockets;
 };
 
 struct nfc_llcp_sock {
        struct sock sk;
-       struct list_head list;
        struct nfc_dev *dev;
        struct nfc_llcp_local *local;
        u32 target_idx;
        u32 nfc_protocol;
 
+       /* Link parameters */
        u8 ssap;
        u8 dsap;
        char *service_name;
        size_t service_name_len;
+       u8 rw;
+       u16 miu;
 
        /* Link variables */
        u8 send_n;
@@ -105,6 +113,9 @@ struct nfc_llcp_sock {
        /* Is the remote peer ready to receive */
        u8 remote_ready;
 
+       /* Reserved source SAP */
+       u8 reserved_ssap;
+
        struct sk_buff_head tx_queue;
        struct sk_buff_head tx_pending_queue;
        struct sk_buff_head tx_backlog_queue;
@@ -164,7 +175,11 @@ struct nfc_llcp_sock {
 #define LLCP_DM_REJ     0x03
 
 
+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);
 struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev);
+struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local);
+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);
@@ -179,8 +194,10 @@ 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_tlv(struct nfc_llcp_local *local,
-                      u8 *tlv_array, u16 tlv_array_len);
+int nfc_llcp_parse_gb_tlv(struct nfc_llcp_local *local,
+                         u8 *tlv_array, u16 tlv_array_len);
+int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
+                                 u8 *tlv_array, u16 tlv_array_len);
 
 /* Commands API */
 void nfc_llcp_recv(void *data, struct sk_buff *skb, int err);
This page took 0.027038 seconds and 5 git commands to generate.