diff options
| author | Jean Tourrilhes <jt@hpl.hp.com> | 2002-06-18 14:13:30 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-06-18 14:13:30 -0400 |
| commit | ffdaa8c00313bf343eebed43b7605b7bca002d1a (patch) | |
| tree | 6e35aba6f0d355da5c71f94b2c68bcd5076276d6 /include | |
| parent | 26d0a7eeb8f5807e6e4794ce4fcb1ff38b4e173a (diff) | |
IrDA update 2/2: big header and initcall cleanup
o [FEATURE] Use new kernel init/exit style, should fix static builds
o [FEATURE] Reduce header dependancies
Before After
net/irda/.depend 14917 13617 B
drivers/net/irda/.depend 16134 14293 B
irda full recompile 3'13 3'10
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/irda/af_irda.h | 82 | ||||
| -rw-r--r-- | include/net/irda/discovery.h | 15 | ||||
| -rw-r--r-- | include/net/irda/ircomm_core.h | 1 | ||||
| -rw-r--r-- | include/net/irda/ircomm_event.h | 2 | ||||
| -rw-r--r-- | include/net/irda/ircomm_tty.h | 1 | ||||
| -rw-r--r-- | include/net/irda/irda-usb.h | 3 | ||||
| -rw-r--r-- | include/net/irda/irda.h | 160 | ||||
| -rw-r--r-- | include/net/irda/irda_device.h | 39 | ||||
| -rw-r--r-- | include/net/irda/iriap.h | 5 | ||||
| -rw-r--r-- | include/net/irda/irlap.h | 31 | ||||
| -rw-r--r-- | include/net/irda/irlap_event.h | 34 | ||||
| -rw-r--r-- | include/net/irda/irlap_frame.h | 20 | ||||
| -rw-r--r-- | include/net/irda/irlmp.h | 6 | ||||
| -rw-r--r-- | include/net/irda/irlmp_event.h | 6 | ||||
| -rw-r--r-- | include/net/irda/irmod.h | 71 | ||||
| -rw-r--r-- | include/net/irda/irttp.h | 5 | ||||
| -rw-r--r-- | include/net/irda/timer.h | 16 | ||||
| -rw-r--r-- | include/net/irda/wrapper.h | 2 |
18 files changed, 279 insertions, 220 deletions
diff --git a/include/net/irda/af_irda.h b/include/net/irda/af_irda.h new file mode 100644 index 000000000000..947a4d653c4a --- /dev/null +++ b/include/net/irda/af_irda.h @@ -0,0 +1,82 @@ +/********************************************************************* + * + * Filename: af_irda.h + * Version: 1.0 + * Description: IrDA sockets declarations + * Status: Stable + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Dec 9 21:13:12 1997 + * Modified at: Fri Jan 28 13:16:32 2000 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef AF_IRDA_H +#define AF_IRDA_H + +#include <linux/irda.h> +#include <net/irda/irda.h> +#include <net/irda/iriap.h> /* struct iriap_cb */ +#include <net/irda/irias_object.h> /* struct ias_value */ +#include <net/irda/irlmp.h> /* struct lsap_cb */ +#include <net/irda/irttp.h> /* struct tsap_cb */ +#include <net/irda/discovery.h> /* struct discovery_t */ + +/* IrDA Socket */ +struct irda_sock { + __u32 saddr; /* my local address */ + __u32 daddr; /* peer address */ + + struct lsap_cb *lsap; /* LSAP used by Ultra */ + __u8 pid; /* Protocol IP (PID) used by Ultra */ + + struct tsap_cb *tsap; /* TSAP used by this connection */ + __u8 dtsap_sel; /* remote TSAP address */ + __u8 stsap_sel; /* local TSAP address */ + + __u32 max_sdu_size_rx; + __u32 max_sdu_size_tx; + __u32 max_data_size; + __u8 max_header_size; + struct qos_info qos_tx; + + __u16 mask; /* Hint bits mask */ + __u16 hints; /* Hint bits */ + + __u32 ckey; /* IrLMP client handle */ + __u32 skey; /* IrLMP service handle */ + + struct ias_object *ias_obj; /* Our service name + lsap in IAS */ + struct iriap_cb *iriap; /* Used to query remote IAS */ + struct ias_value *ias_result; /* Result of remote IAS query */ + + hashbin_t *cachelog; /* Result of discovery query */ + struct discovery_t *cachediscovery; /* Result of selective discovery query */ + + int nslots; /* Number of slots to use for discovery */ + + int errno; /* status of the IAS query */ + + struct sock *sk; + wait_queue_head_t query_wait; /* Wait for the answer to a query */ + struct timer_list watchdog; /* Timeout for discovery */ + + LOCAL_FLOW tx_flow; + LOCAL_FLOW rx_flow; +}; + +#define irda_sk(__sk) ((struct irda_sock *)(__sk)->protinfo) + +#endif /* AF_IRDA_H */ diff --git a/include/net/irda/discovery.h b/include/net/irda/discovery.h index b69dd381ae1e..b24d73a73734 100644 --- a/include/net/irda/discovery.h +++ b/include/net/irda/discovery.h @@ -10,6 +10,7 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,11 +35,23 @@ #include <asm/param.h> #include <net/irda/irda.h> -#include <net/irda/irqueue.h> +#include <net/irda/irqueue.h> /* irda_queue_t */ +#include <net/irda/irlap_event.h> /* LAP_REASON */ #define DISCOVERY_EXPIRE_TIMEOUT (2*sysctl_discovery_timeout*HZ) #define DISCOVERY_DEFAULT_SLOTS 0 +/* + * This type is used by the protocols that transmit 16 bits words in + * little endian format. A little endian machine stores MSB of word in + * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] + * and LSB in byte[1]. + */ +typedef union { + __u16 word; + __u8 byte[2]; +} __u16_host_order; + /* Types of discovery */ typedef enum { DISCOVERY_LOG, /* What's in our discovery log */ diff --git a/include/net/irda/ircomm_core.h b/include/net/irda/ircomm_core.h index 3e891c201231..69b610acd2df 100644 --- a/include/net/irda/ircomm_core.h +++ b/include/net/irda/ircomm_core.h @@ -32,6 +32,7 @@ #define IRCOMM_CORE_H #include <net/irda/irda.h> +#include <net/irda/irqueue.h> #include <net/irda/ircomm_event.h> #define IRCOMM_MAGIC 0x98347298 diff --git a/include/net/irda/ircomm_event.h b/include/net/irda/ircomm_event.h index 8bcffa8acba3..9f0ca85aaabf 100644 --- a/include/net/irda/ircomm_event.h +++ b/include/net/irda/ircomm_event.h @@ -31,6 +31,8 @@ #ifndef IRCOMM_EVENT_H #define IRCOMM_EVENT_H +#include <net/irda/irmod.h> + typedef enum { IRCOMM_IDLE, IRCOMM_WAITI, diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index 77f7dd0d6001..a7cb72ad60ee 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h @@ -34,6 +34,7 @@ #include <linux/serial.h> #include <linux/termios.h> #include <linux/timer.h> +#include <linux/tty.h> /* struct tty_struct */ #include <net/irda/irias_object.h> #include <net/irda/ircomm_core.h> diff --git a/include/net/irda/irda-usb.h b/include/net/irda/irda-usb.h index 9614f2b368e3..3480c84386ec 100644 --- a/include/net/irda/irda-usb.h +++ b/include/net/irda/irda-usb.h @@ -29,8 +29,7 @@ #include <linux/time.h> #include <net/irda/irda.h> -#include <net/irda/irlap.h> -#include <net/irda/irda_device.h> +#include <net/irda/irda_device.h> /* struct irlap_cb */ #define RX_COPY_THRESHOLD 200 #define IRDA_USB_MAX_MTU 2051 diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index 6f89d5df801a..272891b9ceb1 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h @@ -10,7 +10,7 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -27,16 +27,13 @@ #define NET_IRDA_H #include <linux/config.h> -#include <linux/skbuff.h> +#include <linux/skbuff.h> /* struct sk_buff */ #include <linux/kernel.h> -#include <linux/if.h> +#include <linux/if.h> /* sa_family_t in <linux/irda.h> */ #include <linux/irda.h> typedef __u32 magic_t; -#include <net/irda/qos.h> -#include <net/irda/irqueue.h> - #ifndef TRUE #define TRUE 1 #endif @@ -57,8 +54,8 @@ typedef __u32 magic_t; #ifndef IRDA_ALIGN # define IRDA_ALIGN __attribute__((aligned)) #endif -#ifndef PACK -# define PACK __attribute__((packed)) +#ifndef IRDA_PACK +# define IRDA_PACK __attribute__((packed)) #endif @@ -116,151 +113,4 @@ if(!(expr)) do { \ #define IAS_IRCOMM_ID 0x2343 #define IAS_IRLPT_ID 0x9876 -typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; - -/* A few forward declarations (to make compiler happy) */ -struct tsap_cb; /* in <net/irda/irttp.h> */ -struct lsap_cb; /* in <net/irda/irlmp.h> */ -struct iriap_cb; /* in <net/irda/iriap.h> */ -struct ias_value; /* in <net/irda/irias_object.h> */ -struct discovery_t; /* in <net/irda/discovery.h> */ - -/* IrDA Socket */ -struct irda_sock { - __u32 saddr; /* my local address */ - __u32 daddr; /* peer address */ - - struct lsap_cb *lsap; /* LSAP used by Ultra */ - __u8 pid; /* Protocol IP (PID) used by Ultra */ - - struct tsap_cb *tsap; /* TSAP used by this connection */ - __u8 dtsap_sel; /* remote TSAP address */ - __u8 stsap_sel; /* local TSAP address */ - - __u32 max_sdu_size_rx; - __u32 max_sdu_size_tx; - __u32 max_data_size; - __u8 max_header_size; - struct qos_info qos_tx; - - __u16 mask; /* Hint bits mask */ - __u16 hints; /* Hint bits */ - - __u32 ckey; /* IrLMP client handle */ - __u32 skey; /* IrLMP service handle */ - - struct ias_object *ias_obj; /* Our service name + lsap in IAS */ - struct iriap_cb *iriap; /* Used to query remote IAS */ - struct ias_value *ias_result; /* Result of remote IAS query */ - - hashbin_t *cachelog; /* Result of discovery query */ - struct discovery_t *cachediscovery; /* Result of selective discovery query */ - - int nslots; /* Number of slots to use for discovery */ - - int errno; /* status of the IAS query */ - - struct sock *sk; - wait_queue_head_t query_wait; /* Wait for the answer to a query */ - struct timer_list watchdog; /* Timeout for discovery */ - - LOCAL_FLOW tx_flow; - LOCAL_FLOW rx_flow; -}; - -#define irda_sk(__sk) ((struct irda_sock *)(__sk)->protinfo) - -/* - * This type is used by the protocols that transmit 16 bits words in - * little endian format. A little endian machine stores MSB of word in - * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] - * and LSB in byte[1]. - */ -typedef union { - __u16 word; - __u8 byte[2]; -} __u16_host_order; - -/* - * Per-packet information we need to hide inside sk_buff - * (must not exceed 48 bytes, check with struct sk_buff) - */ -struct irda_skb_cb { - magic_t magic; /* Be sure that we can trust the information */ - __u32 next_speed; /* The Speed to be set *after* this frame */ - __u16 mtt; /* Minimum turn around time */ - __u16 xbofs; /* Number of xbofs required, used by SIR mode */ - __u16 next_xbofs; /* Number of xbofs required *after* this frame */ - void *context; /* May be used by drivers */ - void (*destructor)(struct sk_buff *skb); /* Used for flow control */ - __u16 xbofs_delay; /* Number of xbofs used for generating the mtt */ - __u8 line; /* Used by IrCOMM in IrLPT mode */ -}; - -/* Misc status information */ -typedef enum { - STATUS_OK, - STATUS_ABORTED, - STATUS_NO_ACTIVITY, - STATUS_NOISY, - STATUS_REMOTE, -} LINK_STATUS; - -typedef enum { - LOCK_NO_CHANGE, - LOCK_LOCKED, - LOCK_UNLOCKED, -} LOCK_STATUS; - -typedef enum { /* FIXME check the two first reason codes */ - LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */ - LAP_NO_RESPONSE, /* To many retransmits without response */ - LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */ - LAP_FOUND_NONE, /* No devices were discovered */ - LAP_MEDIA_BUSY, - LAP_PRIMARY_CONFLICT, -} LAP_REASON; - -/* - * IrLMP disconnect reasons. The order is very important, since they - * correspond to disconnect reasons sent in IrLMP disconnect frames, so - * please do not touch :-) - */ -typedef enum { - LM_USER_REQUEST = 1, /* User request */ - LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */ - LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */ - LM_LAP_RESET, /* IrLAP reset */ - LM_INIT_DISCONNECT, /* Link Management initiated disconnect */ - LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */ - LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */ - LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */ - LM_CONN_HALF_OPEN, /* Connection is half open */ - LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */ -} LM_REASON; -#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */ - -/* - * Notify structure used between transport and link management layers - */ -typedef struct { - int (*data_indication)(void *priv, void *sap, struct sk_buff *skb); - int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb); - void (*connect_confirm)(void *instance, void *sap, - struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, struct sk_buff *skb); - void (*connect_indication)(void *instance, void *sap, - struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, struct sk_buff *skb); - void (*disconnect_indication)(void *instance, void *sap, - LM_REASON reason, struct sk_buff *); - void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow); - void (*status_indication)(void *instance, - LINK_STATUS link, LOCK_STATUS lock); - void *instance; /* Layer instance pointer */ - char name[16]; /* Name of layer */ -} notify_t; - -#define NOTIFY_MAX_NAME 16 - #endif /* NET_IRDA_H */ diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index 5e59c7545a37..5e6e0049692e 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h @@ -11,6 +11,7 @@ * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>, + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -29,18 +30,27 @@ * ********************************************************************/ +/* + * This header contains all the IrDA definitions a driver really + * needs, and therefore the driver should not need to include + * any other IrDA headers - Jean II + */ + #ifndef IRDA_DEVICE_H #define IRDA_DEVICE_H #include <linux/tty.h> #include <linux/netdevice.h> #include <linux/spinlock.h> +#include <linux/skbuff.h> /* struct sk_buff */ #include <linux/irda.h> #include <net/irda/irda.h> -#include <net/irda/qos.h> -#include <net/irda/irqueue.h> -#include <net/irda/irlap_frame.h> +#include <net/irda/qos.h> /* struct qos_info */ +#include <net/irda/irqueue.h> /* irda_queue_t */ + +/* A few forward declarations (to make compiler happy) */ +struct irlap_cb; /* Some non-standard interface flags (should not conflict with any in if.h) */ #define IFF_SIR 0x0001 /* Supports SIR speeds */ @@ -120,6 +130,22 @@ struct dongle_reg { int (*change_speed)(struct irda_task *task); }; +/* + * Per-packet information we need to hide inside sk_buff + * (must not exceed 48 bytes, check with struct sk_buff) + */ +struct irda_skb_cb { + magic_t magic; /* Be sure that we can trust the information */ + __u32 next_speed; /* The Speed to be set *after* this frame */ + __u16 mtt; /* Minimum turn around time */ + __u16 xbofs; /* Number of xbofs required, used by SIR mode */ + __u16 next_xbofs; /* Number of xbofs required *after* this frame */ + void *context; /* May be used by drivers */ + void (*destructor)(struct sk_buff *skb); /* Used for flow control */ + __u16 xbofs_delay; /* Number of xbofs used for generating the mtt */ + __u8 line; /* Used by IrCOMM in IrLPT mode */ +}; + /* Chip specific info */ typedef struct { int cfg_base; /* Config register IO base */ @@ -158,6 +184,13 @@ typedef struct { int irda_device_init(void); void irda_device_cleanup(void); +/* IrLAP entry points used by the drivers. + * We declare them here to avoid the driver pulling a whole bunch stack + * headers they don't really need - Jean II */ +struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, + char * hw_name); +void irlap_close(struct irlap_cb *self); + /* Interface to be uses by IrLAP */ void irda_device_set_media_busy(struct net_device *dev, int status); int irda_device_is_media_busy(struct net_device *dev); diff --git a/include/net/irda/iriap.h b/include/net/irda/iriap.h index 8aed55b1c94a..917e6701e7ab 100644 --- a/include/net/irda/iriap.h +++ b/include/net/irda/iriap.h @@ -29,11 +29,10 @@ #include <linux/types.h> #include <linux/skbuff.h> -#include <net/irda/qos.h> #include <net/irda/iriap_event.h> #include <net/irda/irias_object.h> -#include <net/irda/irqueue.h> -#include <net/irda/timer.h> +#include <net/irda/irqueue.h> /* irda_queue_t */ +#include <net/irda/timer.h> /* struct timer_list */ #define IAP_LST 0x80 #define IAP_ACK 0x40 diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index ae30117cbf6e..e6aba3b50dcb 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h @@ -11,7 +11,7 @@ * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -33,7 +33,11 @@ #include <linux/netdevice.h> #include <linux/timer.h> -#include <net/irda/irlap_event.h> +#include <net/irda/irqueue.h> /* irda_queue_t */ +#include <net/irda/qos.h> /* struct qos_info */ +#include <net/irda/discovery.h> /* discovery_t */ +#include <net/irda/irlap_event.h> /* IRLAP_STATE, ... */ +#include <net/irda/irmod.h> /* struct notify_t */ #define CONFIG_IRDA_DYNAMIC_WINDOW 1 @@ -85,6 +89,29 @@ #define NS_UNEXPECTED 0 #define NS_INVALID -1 +/* + * Meta information passed within the IrLAP state machine + */ +struct irlap_info { + __u8 caddr; /* Connection address */ + __u8 control; /* Frame type */ + __u8 cmd; + + __u32 saddr; + __u32 daddr; + + int pf; /* Poll/final bit set */ + + __u8 nr; /* Sequence number of next frame expected */ + __u8 ns; /* Sequence number of frame sent */ + + int S; /* Number of slots */ + int slot; /* Random chosen slot */ + int s; /* Current slot */ + + discovery_t *discovery; /* Discovery information */ +}; + /* Main structure of IrLAP */ struct irlap_cb { irda_queue_t q; /* Must be first */ diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h index 9c7b995c316b..2ae2e119ef4b 100644 --- a/include/net/irda/irlap_event.h +++ b/include/net/irda/irlap_event.h @@ -12,7 +12,7 @@ * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -35,9 +35,10 @@ #define IRLAP_EVENT_H #include <net/irda/irda.h> -#include <net/irda/discovery.h> +/* A few forward declarations (to make compiler happy) */ struct irlap_cb; +struct irlap_info; /* IrLAP States */ typedef enum { @@ -108,27 +109,16 @@ typedef enum { } IRLAP_EVENT; /* - * Various things used by the IrLAP state machine + * Disconnect reason code */ -struct irlap_info { - __u8 caddr; /* Connection address */ - __u8 control; /* Frame type */ - __u8 cmd; - - __u32 saddr; - __u32 daddr; - - int pf; /* Poll/final bit set */ - - __u8 nr; /* Sequence number of next frame expected */ - __u8 ns; /* Sequence number of frame sent */ - - int S; /* Number of slots */ - int slot; /* Random chosen slot */ - int s; /* Current slot */ - - discovery_t *discovery; /* Discovery information */ -}; +typedef enum { /* FIXME check the two first reason codes */ + LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */ + LAP_NO_RESPONSE, /* To many retransmits without response */ + LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */ + LAP_FOUND_NONE, /* No devices were discovered */ + LAP_MEDIA_BUSY, + LAP_PRIMARY_CONFLICT, +} LAP_REASON; extern const char *irlap_state[]; diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h index 99a2a95e6678..94c83bc2c4cc 100644 --- a/include/net/irda/irlap_frame.h +++ b/include/net/irda/irlap_frame.h @@ -11,6 +11,7 @@ * * Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -35,8 +36,10 @@ #include <linux/skbuff.h> #include <net/irda/irda.h> -#include <net/irda/irlap.h> -#include <net/irda/qos.h> + +/* A few forward declarations (to make compiler happy) */ +struct irlap_cb; +struct discovery_t; /* Frame types and templates */ #define INVALID 0xff @@ -80,14 +83,14 @@ struct xid_frame { __u8 flags; /* Discovery flags */ __u8 slotnr; __u8 version; -} PACK; +} IRDA_PACK; struct test_frame { __u8 caddr; /* Connection address */ __u8 control; __u32 saddr; /* Source device address */ __u32 daddr; /* Destination device address */ -} PACK; +} IRDA_PACK; struct ua_frame { __u8 caddr; @@ -95,12 +98,12 @@ struct ua_frame { __u32 saddr; /* Source device address */ __u32 daddr; /* Dest device address */ -} PACK; +} IRDA_PACK; struct i_frame { __u8 caddr; __u8 control; -} PACK; +} IRDA_PACK; struct snrm_frame { __u8 caddr; @@ -108,11 +111,12 @@ struct snrm_frame { __u32 saddr; __u32 daddr; __u8 ncaddr; -} PACK; +} IRDA_PACK; void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb); void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s, - __u8 command, discovery_t *discovery); + __u8 command, + struct discovery_t *discovery); void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *); void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, struct sk_buff *cmd); diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index fdbf5f75ae85..8fcc154e42dd 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h @@ -11,7 +11,7 @@ * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,7 +34,7 @@ #include <net/irda/irda.h> #include <net/irda/qos.h> -#include <net/irda/irlap.h> +#include <net/irda/irlap.h> /* LAP_MAX_HEADER, ... */ #include <net/irda/irlmp_event.h> #include <net/irda/irqueue.h> #include <net/irda/discovery.h> @@ -91,8 +91,6 @@ typedef struct { void *priv; /* Used to identify client */ } irlmp_client_t; -struct lap_cb; /* Forward decl. */ - /* * Information about each logical LSAP connection */ diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h index e8af8d3dc676..b056e06c29d1 100644 --- a/include/net/irda/irlmp_event.h +++ b/include/net/irda/irlmp_event.h @@ -11,7 +11,7 @@ * * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -27,9 +27,11 @@ #ifndef IRLMP_EVENT_H #define IRLMP_EVENT_H +/* A few forward declarations (to make compiler happy) */ struct irlmp_cb; struct lsap_cb; struct lap_cb; +struct discovery_t; /* LAP states */ typedef enum { @@ -94,7 +96,7 @@ struct irlmp_event { int reason; - discovery_t *discovery; + struct discovery_t *discovery; }; extern const char *irlmp_state[]; diff --git a/include/net/irda/irmod.h b/include/net/irda/irmod.h index d54720925460..72b446c1e22c 100644 --- a/include/net/irda/irmod.h +++ b/include/net/irda/irmod.h @@ -10,7 +10,7 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,10 +26,70 @@ #ifndef IRMOD_H #define IRMOD_H -#include <net/irda/irda.h> /* Notify stuff */ +/* Misc status information */ +typedef enum { + STATUS_OK, + STATUS_ABORTED, + STATUS_NO_ACTIVITY, + STATUS_NOISY, + STATUS_REMOTE, +} LINK_STATUS; -/* Nothing much here anymore - Maybe this header should be merged in - * another header like net/irda/irda.h... - Jean II */ +typedef enum { + LOCK_NO_CHANGE, + LOCK_LOCKED, + LOCK_UNLOCKED, +} LOCK_STATUS; + +typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; + +/* + * IrLMP disconnect reasons. The order is very important, since they + * correspond to disconnect reasons sent in IrLMP disconnect frames, so + * please do not touch :-) + */ +typedef enum { + LM_USER_REQUEST = 1, /* User request */ + LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */ + LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */ + LM_LAP_RESET, /* IrLAP reset */ + LM_INIT_DISCONNECT, /* Link Management initiated disconnect */ + LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */ + LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */ + LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */ + LM_CONN_HALF_OPEN, /* Connection is half open */ + LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */ +} LM_REASON; +#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */ + +/* A few forward declarations (to make compiler happy) */ +struct qos_info; /* in <net/irda/qos.h> */ + +/* + * Notify structure used between transport and link management layers + */ +typedef struct { + int (*data_indication)(void *priv, void *sap, struct sk_buff *skb); + int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb); + void (*connect_confirm)(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, + __u8 max_header_size, struct sk_buff *skb); + void (*connect_indication)(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, + __u8 max_header_size, struct sk_buff *skb); + void (*disconnect_indication)(void *instance, void *sap, + LM_REASON reason, struct sk_buff *); + void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow); + void (*status_indication)(void *instance, + LINK_STATUS link, LOCK_STATUS lock); + void *instance; /* Layer instance pointer */ + char name[16]; /* Name of layer */ +} notify_t; + +#define NOTIFY_MAX_NAME 16 + +/* Zero the notify structure */ +void irda_notify_init(notify_t *notify); /* Locking wrapper - Note the inverted logic on irda_lock(). * Those function basically return false if the lock is already in the @@ -37,9 +97,6 @@ #define irda_lock(lock) (! test_and_set_bit(0, (void *) (lock))) #define irda_unlock(lock) (test_and_clear_bit(0, (void *) (lock))) -/* Zero the notify structure */ -void irda_notify_init(notify_t *notify); - #endif /* IRMOD_H */ diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index c23257ef5559..ef4727f6059b 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h @@ -11,6 +11,7 @@ * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -31,8 +32,8 @@ #include <linux/spinlock.h> #include <net/irda/irda.h> -#include <net/irda/irlmp.h> -#include <net/irda/qos.h> +#include <net/irda/irlmp.h> /* struct lsap_cb */ +#include <net/irda/qos.h> /* struct qos_info */ #include <net/irda/irqueue.h> #define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h index ba648b9b9443..84d339480ddc 100644 --- a/include/net/irda/timer.h +++ b/include/net/irda/timer.h @@ -11,7 +11,7 @@ * * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> + * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -27,15 +27,17 @@ #ifndef TIMER_H #define TIMER_H -#include <linux/netdevice.h> +#include <linux/timer.h> #include <asm/param.h> /* for HZ */ #include <net/irda/irda.h> -#include <net/irda/irmod.h> -#include <net/irda/irlap.h> -#include <net/irda/irlmp.h> -#include <net/irda/irda_device.h> + +/* A few forward declarations (to make compiler happy) */ +struct irlmp_cb; +struct irlap_cb; +struct lsap_cb; +struct lap_cb; /* * Timeout definitions, some defined in IrLAP p. 92 @@ -81,8 +83,6 @@ inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout); void irlap_stop_mbusy_timer(struct irlap_cb *); -struct lsap_cb; -struct lap_cb; inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); diff --git a/include/net/irda/wrapper.h b/include/net/irda/wrapper.h index 5dc0b0d16d90..47774e0ab0e4 100644 --- a/include/net/irda/wrapper.h +++ b/include/net/irda/wrapper.h @@ -30,7 +30,7 @@ #include <linux/skbuff.h> #include <linux/netdevice.h> -#include <net/irda/irda_device.h> +#include <net/irda/irda_device.h> /* iobuff_t */ #define BOF 0xc0 /* Beginning of frame */ #define XBOF 0xff |
