Back to home page

OSCL-LXR

 
 

    


0001 #ifndef LLC_CONN_H
0002 #define LLC_CONN_H
0003 /*
0004  * Copyright (c) 1997 by Procom Technology, Inc.
0005  *       2001, 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
0006  *
0007  * This program can be redistributed or modified under the terms of the
0008  * GNU General Public License as published by the Free Software Foundation.
0009  * This program is distributed without any warranty or implied warranty
0010  * of merchantability or fitness for a particular purpose.
0011  *
0012  * See the GNU General Public License for more details.
0013  */
0014 #include <linux/timer.h>
0015 #include <net/llc_if.h>
0016 #include <net/sock.h>
0017 #include <linux/llc.h>
0018 
0019 #define LLC_EVENT                1
0020 #define LLC_PACKET               2
0021 
0022 #define LLC2_P_TIME               2
0023 #define LLC2_ACK_TIME             1
0024 #define LLC2_REJ_TIME             3
0025 #define LLC2_BUSY_TIME            3
0026 
0027 struct llc_timer {
0028     struct timer_list timer;
0029     unsigned long     expire;   /* timer expire time */
0030 };
0031 
0032 struct llc_sock {
0033     /* struct sock must be the first member of llc_sock */
0034     struct sock     sk;
0035     struct sockaddr_llc addr;       /* address sock is bound to */
0036     u8          state;      /* state of connection */
0037     struct llc_sap      *sap;       /* pointer to parent SAP */
0038     struct llc_addr     laddr;      /* lsap/mac pair */
0039     struct llc_addr     daddr;      /* dsap/mac pair */
0040     struct net_device   *dev;       /* device to send to remote */
0041     netdevice_tracker   dev_tracker;
0042     u32         copied_seq;     /* head of yet unread data */
0043     u8          retry_count;    /* number of retries */
0044     u8          ack_must_be_send;
0045     u8          first_pdu_Ns;
0046     u8          npta;
0047     struct llc_timer    ack_timer;
0048     struct llc_timer    pf_cycle_timer;
0049     struct llc_timer    rej_sent_timer;
0050     struct llc_timer    busy_state_timer;   /* ind busy clr at remote LLC */
0051     u8          vS;         /* seq# next in-seq I-PDU tx'd*/
0052     u8          vR;         /* seq# next in-seq I-PDU rx'd*/
0053     u32         n2;         /* max nbr re-tx's for timeout*/
0054     u32         n1;         /* max nbr octets in I PDU */
0055     u8          k;          /* tx window size; max = 127 */
0056     u8          rw;         /* rx window size; max = 127 */
0057     u8          p_flag;     /* state flags */
0058     u8          f_flag;
0059     u8          s_flag;
0060     u8          data_flag;
0061     u8          remote_busy_flag;
0062     u8          cause_flag;
0063     struct sk_buff_head pdu_unack_q;    /* PUDs sent/waiting ack */
0064     u16         link;       /* network layer link number */
0065     u8          X;          /* a temporary variable */
0066     u8          ack_pf;     /* this flag indicates what is
0067                            the P-bit of acknowledge */
0068     u8          failed_data_req; /* recognize that already exist a
0069                         failed llc_data_req_handler
0070                         (tx_buffer_full or unacceptable
0071                         state */
0072     u8          dec_step;
0073     u8          inc_cntr;
0074     u8          dec_cntr;
0075     u8          connect_step;
0076     u8          last_nr;       /* NR of last pdu received */
0077     u32         rx_pdu_hdr;    /* used for saving header of last pdu
0078                           received and caused sending FRMR.
0079                           Used for resending FRMR */
0080     u32         cmsg_flags;
0081     struct hlist_node   dev_hash_node;
0082 };
0083 
0084 static inline struct llc_sock *llc_sk(const struct sock *sk)
0085 {
0086     return (struct llc_sock *)sk;
0087 }
0088 
0089 static __inline__ void llc_set_backlog_type(struct sk_buff *skb, char type)
0090 {
0091     skb->cb[sizeof(skb->cb) - 1] = type;
0092 }
0093 
0094 static __inline__ char llc_backlog_type(struct sk_buff *skb)
0095 {
0096     return skb->cb[sizeof(skb->cb) - 1];
0097 }
0098 
0099 struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority,
0100               struct proto *prot, int kern);
0101 void llc_sk_stop_all_timers(struct sock *sk, bool sync);
0102 void llc_sk_free(struct sock *sk);
0103 
0104 void llc_sk_reset(struct sock *sk);
0105 
0106 /* Access to a connection */
0107 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
0108 void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
0109 void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
0110 void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
0111 void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
0112 int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr, u16 *how_many_unacked);
0113 struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *daddr,
0114                     struct llc_addr *laddr);
0115 void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk);
0116 void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
0117 
0118 u8 llc_data_accept_state(u8 state);
0119 void llc_build_offset_table(void);
0120 #endif /* LLC_CONN_H */