summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.ninka.net>2002-09-13 01:41:06 -0700
committerDavid S. Miller <davem@nuts.ninka.net>2002-09-13 01:41:06 -0700
commited54ae2e3d2cabd389e9daf52536ac2939706aa2 (patch)
treed414c27bc1e1a92ab8cfca6145fd6cce4e9ec7b8 /include
parentc39f732042a43ded87dbe10efa3a2e0990e0f3d9 (diff)
parent96b2cae773183e8298385cf05103b3abeb3cfa7e (diff)
Merge master.kernel.org:/home/acme/BK/llc-2.5
into nuts.ninka.net:/home/davem/src/BK/llc-2.5
Diffstat (limited to 'include')
-rw-r--r--include/linux/llc.h11
-rw-r--r--include/net/llc_c_st.h12
-rw-r--r--include/net/llc_conn.h73
-rw-r--r--include/net/llc_if.h68
-rw-r--r--include/net/llc_mac.h41
-rw-r--r--include/net/llc_main.h4
-rw-r--r--include/net/llc_pdu.h56
-rw-r--r--include/net/llc_sap.h5
8 files changed, 115 insertions, 155 deletions
diff --git a/include/linux/llc.h b/include/linux/llc.h
index 824a149e9e6b..77ac5d9df544 100644
--- a/include/linux/llc.h
+++ b/include/linux/llc.h
@@ -78,17 +78,6 @@ enum llc_sockopts {
#define LLC_SAP_DYN_STOP 0xDE
#define LLC_SAP_DYN_TRIES 4
-struct sock;
-
-struct llc_ui_opt {
- u16 link; /* network layer link number */
- struct llc_sap *sap; /* pointer to parent SAP */
- struct sock *core_sk;
- struct net_device *dev; /* device to send to remote */
- struct sockaddr_llc addr; /* address sock is bound to */
-};
-
-#define llc_ui_sk(__sk) ((struct llc_ui_opt *)(__sk)->protinfo)
#define llc_ui_skb_cb(__skb) ((struct sockaddr_llc *)&((__skb)->cb[0]))
#ifdef CONFIG_LLC_UI
diff --git a/include/net/llc_c_st.h b/include/net/llc_c_st.h
index f0b40ed22754..0e79cfba4b3b 100644
--- a/include/net/llc_c_st.h
+++ b/include/net/llc_c_st.h
@@ -33,15 +33,15 @@
/* Connection state table structure */
struct llc_conn_state_trans {
- llc_conn_ev_t ev;
- u8 next_state;
- llc_conn_ev_qfyr_t *ev_qualifiers;
- llc_conn_action_t *ev_actions;
+ llc_conn_ev_t ev;
+ u8 next_state;
+ llc_conn_ev_qfyr_t *ev_qualifiers;
+ llc_conn_action_t *ev_actions;
};
struct llc_conn_state {
- u8 current_state;
- struct llc_conn_state_trans **transitions;
+ u8 current_state;
+ struct llc_conn_state_trans **transitions;
};
extern struct llc_conn_state llc_conn_state_table[];
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index db42c7f6fc78..5846a5b91841 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -2,7 +2,7 @@
#define LLC_CONN_H
/*
* Copyright (c) 1997 by Procom Technology, Inc.
- * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ * 2001, 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation.
@@ -13,8 +13,7 @@
*/
#include <linux/timer.h>
#include <net/llc_if.h>
-
-#undef DEBUG_LLC_CONN_ALLOC
+#include <linux/llc.h>
struct llc_timer {
struct timer_list timer;
@@ -25,7 +24,7 @@ struct llc_timer {
struct llc_opt {
struct list_head node; /* entry in sap->sk_list.list */
struct sock *sk; /* sock that has this llc_opt */
- void *handler; /* for upper layers usage */
+ struct sockaddr_llc addr; /* address sock is bound to */
u8 state; /* state of connection */
struct llc_sap *sap; /* pointer to parent SAP */
struct llc_addr laddr; /* lsap/mac pair */
@@ -80,63 +79,14 @@ struct llc_opt {
struct llc_conn_state_ev;
-extern struct sock *__llc_sock_alloc(void);
-extern void __llc_sock_free(struct sock *sk, u8 free);
-
-#ifdef DEBUG_LLC_CONN_ALLOC
-#define dump_stack() printk(KERN_INFO "call trace: %p, %p, %p\n", \
- __builtin_return_address(0), \
- __builtin_return_address(1), \
- __builtin_return_address(2));
-#define llc_sock_alloc() ({ \
- struct sock *__sk = __llc_sock_alloc(); \
- if (__sk) { \
- llc_sk(__sk)->f_alloc = __FUNCTION__; \
- llc_sk(__sk)->l_alloc = __LINE__; \
- } \
- __sk;})
-#define __llc_sock_assert(__sk) \
- if (llc_sk(__sk)->f_free) { \
- printk(KERN_ERR \
- "%p conn (alloc'd @ %s(%d)) " \
- "already freed @ %s(%d) " \
- "being used again @ %s(%d)\n", \
- llc_sk(__sk), \
- llc_sk(__sk)->f_alloc, llc_sk(__sk)->l_alloc, \
- llc_sk(__sk)->f_free, llc_sk(__sk)->l_free, \
- __FUNCTION__, __LINE__); \
- dump_stack();
-#define llc_sock_free(__sk) \
-{ \
- __llc_sock_assert(__sk) \
- } else { \
- __llc_sock_free(__sk, 0); \
- llc_sk(__sk)->f_free = __FUNCTION__; \
- llc_sk(__sk)->l_free = __LINE__; \
- } \
-}
-#define llc_sock_assert(__sk) \
-{ \
- __llc_sock_assert(__sk); \
- return; } \
-}
-#define llc_sock_assert_ret(__sk, __ret) \
-{ \
- __llc_sock_assert(__sk); \
- return __ret; } \
-}
-#else /* DEBUG_LLC_CONN_ALLOC */
-#define llc_sock_alloc() __llc_sock_alloc()
-#define llc_sock_free(__sk) __llc_sock_free(__sk, 1)
-#define llc_sock_assert(__sk)
-#define llc_sock_assert_ret(__sk)
-#endif /* DEBUG_LLC_CONN_ALLOC */
+extern struct sock *llc_sk_alloc(int family, int priority);
+extern void llc_sk_free(struct sock *sk);
-extern void llc_sock_reset(struct sock *sk);
-extern int llc_sock_init(struct sock *sk);
+extern void llc_sk_reset(struct sock *sk);
+extern int llc_sk_init(struct sock *sk);
/* Access to a connection */
-extern int llc_conn_send_ev(struct sock *sk, struct sk_buff *skb);
+extern int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
extern void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
extern void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
extern void llc_conn_free_ev(struct sk_buff *skb);
@@ -146,8 +96,11 @@ extern void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr,
u8 first_f_bit);
extern int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr,
u16 *how_many_unacked);
-extern struct sock *llc_find_sock(struct llc_sap *sap, struct llc_addr *daddr,
- struct llc_addr *laddr);
+extern struct sock *llc_lookup_established(struct llc_sap *sap,
+ struct llc_addr *daddr,
+ struct llc_addr *laddr);
+extern struct sock *llc_lookup_listener(struct llc_sap *sap,
+ struct llc_addr *laddr);
extern u8 llc_data_accept_state(u8 state);
extern void llc_build_offset_table(void);
#endif /* LLC_CONN_H */
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index cc2348004161..e17373a17c00 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -14,13 +14,15 @@
/* Defines LLC interface to network layer */
/* Available primitives */
#include <linux/if.h>
+#include <linux/if_arp.h>
+#include <linux/llc.h>
#define LLC_DATAUNIT_PRIM 0
#define LLC_CONN_PRIM 1
#define LLC_DATA_PRIM 2
#define LLC_DISC_PRIM 3
#define LLC_RESET_PRIM 4
-#define LLC_FLOWCONTROL_PRIM 5
+#define LLC_FLOWCONTROL_PRIM 5 /* Not supported at this time */
#define LLC_DISABLE_PRIM 6
#define LLC_XID_PRIM 7
#define LLC_TEST_PRIM 8
@@ -65,46 +67,12 @@ struct llc_addr {
u8 mac[IFHWADDRLEN];
};
-/* Primitive-specific data */
-struct llc_prim_conn {
- struct llc_addr saddr; /* used by request only */
- struct llc_addr daddr; /* used by request only */
- u8 status; /* reason for failure */
- u8 pri; /* service_class */
- struct net_device *dev;
- struct sock *sk; /* returned from REQUEST */
- void *handler; /* upper layer use,
- stored in llc_opt->handler */
- u16 link;
- struct sk_buff *skb; /* received SABME */
-};
-
-struct llc_prim_disc {
- struct sock *sk;
- u16 link;
- u8 reason; /* not used by request */
-};
-
struct llc_prim_reset {
struct sock *sk;
u16 link;
u8 reason; /* used only by indicate */
};
-struct llc_prim_flow_ctrl {
- struct sock *sk;
- u16 link;
- u32 amount;
-};
-
-struct llc_prim_data {
- struct sock *sk;
- u16 link;
- u8 pri;
- struct sk_buff *skb; /* pointer to frame */
- u8 status; /* reason */
-};
-
/* Sending data in conection-less mode */
struct llc_prim_unit_data {
struct llc_addr saddr;
@@ -129,11 +97,7 @@ struct llc_prim_test {
};
union llc_u_prim_data {
- struct llc_prim_conn conn;
- struct llc_prim_disc disc;
struct llc_prim_reset res;
- struct llc_prim_flow_ctrl fc;
- struct llc_prim_data data; /* data */
struct llc_prim_unit_data udata; /* unit data */
struct llc_prim_xid xid;
struct llc_prim_test test;
@@ -152,4 +116,30 @@ typedef int (*llc_prim_call_t)(struct llc_prim_if_block *prim_if);
extern struct llc_sap *llc_sap_open(llc_prim_call_t network_indicate,
llc_prim_call_t network_confirm, u8 lsap);
extern void llc_sap_close(struct llc_sap *sap);
+
+extern int llc_establish_connection(struct sock *sk, u8 *lmac,
+ u8 *dmac, u8 dsap);
+extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
+extern void llc_build_and_send_ui_pkt(struct llc_sap *sap,
+ struct sk_buff *skb,
+ struct sockaddr_llc *addr);
+extern void llc_build_and_send_xid_pkt(struct llc_sap *sap,
+ struct sk_buff *skb,
+ struct sockaddr_llc *addr);
+extern void llc_build_and_send_test_pkt(struct llc_sap *sap,
+ struct sk_buff *skb,
+ struct sockaddr_llc *addr);
+extern int llc_send_disc(struct sock *sk);
+
+/**
+ * llc_proto_type - return eth protocol for ARP header type
+ * @arphrd: ARP header type.
+ *
+ * Given an ARP header type return the corresponding ethernet protocol.
+ */
+static __inline__ u16 llc_proto_type(u16 arphrd)
+{
+ return arphrd == ARPHRD_IEEE802_TR ?
+ htons(ETH_P_TR_802_2) : htons(ETH_P_802_2);
+}
#endif /* LLC_IF_H */
diff --git a/include/net/llc_mac.h b/include/net/llc_mac.h
index 9f2fb80ba98e..3ab584987448 100644
--- a/include/net/llc_mac.h
+++ b/include/net/llc_mac.h
@@ -2,7 +2,7 @@
#define LLC_MAC_H
/*
* Copyright (c) 1997 by Procom Technology, Inc.
- * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ * 2001, 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation.
@@ -13,13 +13,12 @@
*/
/* Defines MAC-layer interface to LLC layer */
extern int mac_send_pdu(struct sk_buff *skb);
-extern int mac_indicate(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt);
+extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt);
extern struct net_device *mac_dev_peer(struct net_device *current_dev,
int type, u8 *mac);
-extern int llc_pdu_router(struct llc_sap *sap, struct sock *sk,
- struct sk_buff *skb, u8 type);
extern u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da);
+extern int llc_conn_rcv(struct sock *sk, struct sk_buff *skb);
static __inline__ void llc_set_backlog_type(struct sk_buff *skb, char type)
{
@@ -31,4 +30,36 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
return skb->cb[sizeof(skb->cb) - 1];
}
+extern u8 llc_mac_null_var[IFHWADDRLEN];
+
+/**
+ * llc_mac_null - determines if a address is a null mac address
+ * @mac: Mac address to test if null.
+ *
+ * Determines if a given address is a null mac address. Returns 0 if the
+ * address is not a null mac, 1 if the address is a null mac.
+ */
+static __inline__ int llc_mac_null(u8 *mac)
+{
+ return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN);
+}
+
+static __inline__ int llc_addrany(struct llc_addr *addr)
+{
+ return llc_mac_null(addr->mac) && !addr->lsap;
+}
+
+/**
+ * llc_mac_match - determines if two mac addresses are the same
+ * @mac1: First mac address to compare.
+ * @mac2: Second mac address to compare.
+ *
+ * Determines if two given mac address are the same. Returns 0 if there
+ * is not a complete match up to len, 1 if a complete match up to len is
+ * found.
+ */
+static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2)
+{
+ return !memcmp(mac1, mac2, IFHWADDRLEN);
+}
#endif /* LLC_MAC_H */
diff --git a/include/net/llc_main.h b/include/net/llc_main.h
index e3aa4d2c7632..31810831fceb 100644
--- a/include/net/llc_main.h
+++ b/include/net/llc_main.h
@@ -61,8 +61,8 @@ extern void llc_sap_save(struct llc_sap *sap);
extern void llc_free_sap(struct llc_sap *sap);
extern struct llc_sap *llc_sap_find(u8 lsap);
extern struct llc_station *llc_station_get(void);
-extern void llc_station_send_ev(struct llc_station *station,
- struct sk_buff *skb);
+extern void llc_station_state_process(struct llc_station *station,
+ struct sk_buff *skb);
extern void llc_station_send_pdu(struct llc_station *station,
struct sk_buff *skb);
extern struct sk_buff *llc_alloc_frame(void);
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 6236c0cab669..02145e59174c 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -237,35 +237,35 @@ struct llc_frmr_info {
extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);
extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
-extern int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit);
-extern int llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit);
-extern int llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa);
-extern int llc_pdu_decode_da(struct sk_buff *skb, u8 *ds);
-extern int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap);
-extern int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap);
-extern int llc_decode_pdu_type(struct sk_buff *skb, u8 *destination);
+extern void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit);
+extern void llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit);
+extern void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa);
+extern void llc_pdu_decode_da(struct sk_buff *skb, u8 *ds);
+extern void llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap);
+extern void llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap);
+extern void llc_decode_pdu_type(struct sk_buff *skb, u8 *destination);
extern void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap,
u8 dsap, u8 cr);
-extern int llc_pdu_init_as_ui_cmd(struct sk_buff *skb);
-extern int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
+extern void llc_pdu_init_as_ui_cmd(struct sk_buff *skb);
+extern void llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window);
-extern int llc_pdu_init_as_test_cmd(struct sk_buff *skb);
-extern int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit);
-extern int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr);
-extern int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
-extern int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
-extern int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
-extern int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit);
-extern int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit);
-extern int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
- u8 rx_window);
-extern int llc_pdu_init_as_test_rsp(struct sk_buff *skb,
- struct sk_buff *ev_skb);
-extern int 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);
-extern int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
-extern int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
-extern int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
-extern int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
+extern void llc_pdu_init_as_test_cmd(struct sk_buff *skb);
+extern void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit);
+extern void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr);
+extern void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
+extern void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
+extern void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
+extern void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit);
+extern void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit);
+extern void llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
+ u8 rx_window);
+extern void llc_pdu_init_as_test_rsp(struct sk_buff *skb,
+ struct sk_buff *ev_skb);
+extern 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);
+extern void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
+extern void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
+extern void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
+extern void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
#endif /* LLC_PDU_H */
diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h
index 3fd694a166e6..1357da860c04 100644
--- a/include/net/llc_sap.h
+++ b/include/net/llc_sap.h
@@ -18,7 +18,6 @@
* @p_bit - only lowest-order bit used
* @f_bit - only lowest-order bit used
* @req - provided by LLC layer
- * @resp - provided by LLC layer
* @ind - provided by network layer
* @conf - provided by network layer
* @laddr - SAP value in this 'lsap'
@@ -31,8 +30,6 @@ struct llc_sap {
u8 state;
u8 p_bit;
u8 f_bit;
- llc_prim_call_t req;
- llc_prim_call_t resp;
llc_prim_call_t ind;
llc_prim_call_t conf;
struct llc_prim_if_block llc_ind_prim, llc_cfm_prim;
@@ -49,7 +46,7 @@ struct llc_sap_state_ev;
extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk);
-extern void llc_sap_send_ev(struct llc_sap *sap, struct sk_buff *skb);
+extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb);
#endif /* LLC_SAP_H */