Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

irlmp.c File Reference

#include <linux/config.h>
#include <linux/malloc.h>
#include <linux/string.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/random.h>
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/timer.h>
#include <net/irda/qos.h>
#include <net/irda/irlap.h>
#include <net/irda/iriap.h>
#include <net/irda/irlmp.h>
#include <net/irda/irlmp_frame.h>

Include dependency graph for irlmp.c:

Go to the source code of this file.

Functions

__u8irlmp_hint_to_service (__u8 *hint)
int __init irlmp_init (void)
void irlmp_cleanup (void)
lsap_cbirlmp_open_lsap (__u8 slsap_sel, notify_t *notify, __u8 pid)
static void __irlmp_close_lsap (struct lsap_cb *self)
void irlmp_close_lsap (struct lsap_cb *self)
void irlmp_register_link (struct irlap_cb *irlap, __u32 saddr, notify_t *notify)
void irlmp_unregister_link (__u32 saddr)
int irlmp_connect_request (struct lsap_cb *self, __u8 dlsap_sel, __u32 saddr, __u32 daddr, struct qos_info *qos, struct sk_buff *userdata)
void irlmp_connect_indication (struct lsap_cb *self, struct sk_buff *skb)
int irlmp_connect_response (struct lsap_cb *self, struct sk_buff *userdata)
void irlmp_connect_confirm (struct lsap_cb *self, struct sk_buff *skb)
lsap_cbirlmp_dup (struct lsap_cb *orig, void *instance)
int irlmp_disconnect_request (struct lsap_cb *self, struct sk_buff *userdata)
void irlmp_disconnect_indication (struct lsap_cb *self, LM_REASON reason, struct sk_buff *userdata)
void irlmp_do_discovery (int nslots)
void irlmp_discovery_request (int nslots)
void irlmp_notify_client (irlmp_client_t *client, hashbin_t *log)
void irlmp_discovery_confirm (hashbin_t *log)
discovery_tirlmp_get_discovery_response ()
int irlmp_data_request (struct lsap_cb *self, struct sk_buff *skb)
void irlmp_data_indication (struct lsap_cb *self, struct sk_buff *skb)
int irlmp_udata_request (struct lsap_cb *self, struct sk_buff *skb)
void irlmp_udata_indication (struct lsap_cb *self, struct sk_buff *skb)
void irlmp_status_request (void)
void irlmp_status_indication (LINK_STATUS link, LOCK_STATUS lock)
__u16 irlmp_service_to_hint (int service)
__u32 irlmp_register_service (__u16 hints)
int irlmp_unregister_service (__u32 handle)
__u32 irlmp_register_client (__u16 hint_mask, DISCOVERY_CALLBACK1 callback1, DISCOVERY_CALLBACK2 callback2)
int irlmp_update_client (__u32 handle, __u16 hint_mask, DISCOVERY_CALLBACK1 callback1, DISCOVERY_CALLBACK2 callback2)
int irlmp_unregister_client (__u32 handle)
int irlmp_slsap_inuse (__u8 slsap_sel)
__u8 irlmp_find_free_slsap (void)
LM_REASON irlmp_convert_lap_reason (LAP_REASON lap_reason)
__u32 irlmp_get_saddr (struct lsap_cb *self)
__u32 irlmp_get_daddr (struct lsap_cb *self)

Variables

irlmp_cbirlmp = NULL
int sysctl_discovery = 0
int sysctl_discovery_timeout = 3
int sysctl_discovery_slots = 6
char sysctl_devname [65]
char * lmp_reasons []


Function Documentation

static void __irlmp_close_lsap struct lsap_cb self  )  [static]
 

Definition at line 192 of file irlmp.c.

References ASSERT, lsap_cb::conn_skb, del_timer(), dev_kfree_skb, FALSE, IRDA_DEBUG, kfree(), LMP_LSAP_MAGIC, lsap_cb::magic, NULL, and lsap_cb::watchdog_timer.

Referenced by irlmp_close_lsap().

Here is the call graph for this function:

void irlmp_cleanup void   ) 
 

Definition at line 111 of file irlmp.c.

References ASSERT, irlmp_cb::cachelog, irlmp_cb::clients, del_timer(), irlmp_cb::discovery_timer, hashbin_delete(), kfree(), irlmp_cb::links, LMP_MAGIC, irlmp_cb::magic, NULL, irlmp_cb::services, and irlmp_cb::unconnected_lsaps.

Here is the call graph for this function:

void irlmp_close_lsap struct lsap_cb self  ) 
 

Definition at line 221 of file irlmp.c.

References __irlmp_close_lsap(), ASSERT, hashbin_remove(), IRDA_DEBUG, LMP_LAP_MAGIC, LMP_LSAP_MAGIC, lap_cb::lsaps, lap_cb::magic, lsap_cb::magic, NULL, and irlmp_cb::unconnected_lsaps.

Referenced by __ircomm_close(), irda_destroy_socket(), iriap_close(), and irttp_close_tsap().

Here is the call graph for this function:

void irlmp_connect_confirm struct lsap_cb self,
struct sk_buff skb
 

Definition at line 515 of file irlmp.c.

References ASSERT, notify_t::connect_confirm, notify_t::instance, IRDA_DEBUG, lap_cb::irlap, IRLAP_GET_HEADER_SIZE, lsap_cb::lap, LMP_CONTROL_HEADER, LMP_HEADER, LMP_LSAP_MAGIC, lsap_cb::magic, lsap_cb::notify, NULL, and lsap_cb::qos.

Referenced by irlmp_state_setup().

void irlmp_connect_indication struct lsap_cb self,
struct sk_buff skb
 

Definition at line 439 of file irlmp.c.

References ASSERT, notify_t::connect_indication, lsap_cb::dlsap_sel, notify_t::instance, IRDA_DEBUG, lap_cb::irlap, IRLAP_GET_HEADER_SIZE, lsap_cb::lap, LMP_CONTROL_HEADER, LMP_HEADER, LMP_LSAP_MAGIC, lsap_cb::magic, lsap_cb::notify, NULL, lsap_cb::qos, and lsap_cb::slsap_sel.

Referenced by irlmp_state_connect_pend().

int irlmp_connect_request struct lsap_cb self,
__u8  dlsap_sel,
__u32  saddr,
__u32  daddr,
struct qos_info qos,
struct sk_buff userdata
 

Definition at line 331 of file irlmp.c.

References ASSERT, irlmp_cb::cachelog, lsap_cb::connected, lap_cb::daddr, discovery_t::daddr, DEV_ADDR_ANY, EBADR, EBUSY, EHOSTUNREACH, EINVAL, EISCONN, ENOMEM, hashbin_find(), hashbin_get_first(), hashbin_insert(), hashbin_remove(), IRDA_DEBUG, irlmp_do_lsap_event(), lsap_cb::lap, irlmp_cb::links, LM_CONNECT_REQUEST, LMP_CONTROL_HEADER, LMP_LAP_MAGIC, LMP_LSAP_MAGIC, LMP_MAX_HEADER, lap_cb::magic, lsap_cb::magic, NULL, discovery_t::saddr, lsap_cb::slsap_sel, TRUE, and irlmp_cb::unconnected_lsaps.

Referenced by ircomm_lmp_connect_request(), iriap_connect_request(), and irttp_connect_request().

Here is the call graph for this function:

int irlmp_connect_response struct lsap_cb self,
struct sk_buff userdata
 

Definition at line 474 of file irlmp.c.

References ASSERT, ENOMEM, IRDA_DEBUG, irlmp_do_lsap_event(), LM_CONNECT_RESPONSE, LMP_CONTROL_HEADER, LMP_LSAP_MAGIC, LMP_MAX_HEADER, NULL, and TRUE.

Referenced by ircomm_lmp_connect_response(), irttp_connect_response(), and state_r_disconnect().

Here is the call graph for this function:

LM_REASON irlmp_convert_lap_reason LAP_REASON  lap_reason  ) 
 

Definition at line 1457 of file irlmp.c.

References IRDA_DEBUG, LAP_DISC_INDICATION, LAP_FOUND_NONE, LAP_MEDIA_BUSY, LAP_NO_RESPONSE, LAP_PRIMARY_CONFLICT, LAP_RESET_INDICATION, LM_CONNECT_FAILURE, LM_LAP_DISCONNECT, LM_LAP_RESET, LM_USER_REQUEST, and lap_cb::reason.

Referenced by irlmp_state_dtr(), irlmp_state_setup(), and irlmp_state_setup_pend().

void irlmp_data_indication struct lsap_cb self,
struct sk_buff skb
 

Definition at line 934 of file irlmp.c.

References notify_t::data_indication, dev_kfree_skb, notify_t::instance, LMP_HEADER, and lsap_cb::notify.

Referenced by irlmp_link_data_indication(), and irlmp_state_dtr().

int irlmp_data_request struct lsap_cb self,
struct sk_buff skb
 

Definition at line 916 of file irlmp.c.

References ASSERT, irlmp_do_lsap_event(), LM_DATA_REQUEST, LMP_HEADER, LMP_LSAP_MAGIC, lsap_cb::magic, and NULL.

Referenced by ircomm_lmp_data_request(), iriap_send_ack(), irttp_give_credit(), irttp_run_tx_queue(), state_r_execute(), and state_s_make_call().

Here is the call graph for this function:

void irlmp_disconnect_indication struct lsap_cb self,
LM_REASON  reason,
struct sk_buff userdata
 

Definition at line 647 of file irlmp.c.

References ASSERT, lsap_cb::connected, dev_kfree_skb, lsap_cb::dlsap_sel, FALSE, hashbin_insert(), hashbin_remove(), IRDA_DEBUG, lsap_cb::lap, LMP_LSAP_MAGIC, lmp_reasons, LSAP_ANY, lap_cb::lsaps, lsap_cb::magic, NULL, lsap_cb::slsap_sel, TRUE, and irlmp_cb::unconnected_lsaps.

Referenced by irlmp_state_dtr(), irlmp_state_setup(), and irlmp_state_setup_pend().

Here is the call graph for this function:

int irlmp_disconnect_request struct lsap_cb self,
struct sk_buff userdata
 

Definition at line 593 of file irlmp.c.

References ASSERT, lsap_cb::connected, FALSE, hashbin_insert(), hashbin_remove(), irlmp_do_lsap_event(), lsap_cb::lap, LM_DISCONNECT_REQUEST, LMP_CONTROL_HEADER, LMP_LAP_MAGIC, LMP_LSAP_MAGIC, LSAP_ANY, lap_cb::lsaps, lap_cb::magic, lsap_cb::magic, NULL, TRUE, irlmp_cb::unconnected_lsaps, and WARNING.

Referenced by ircomm_lmp_disconnect_request(), iriap_disconnect_request(), and irttp_disconnect_request().

Here is the call graph for this function:

void irlmp_discovery_confirm hashbin_t log  ) 
 

Definition at line 862 of file irlmp.c.

References ASSERT, irlmp_cb::clients, hashbin_get_first(), hashbin_get_next(), HASHBIN_GET_SIZE, IRDA_DEBUG, irlmp_notify_client(), and NULL.

Referenced by irlmp_discovery_request(), and irlmp_state_standby().

Here is the call graph for this function:

void irlmp_discovery_request int  nslots  ) 
 

Definition at line 751 of file irlmp.c.

References irlmp_cb::cachelog, DISCOVERY_DEFAULT_SLOTS, irlmp_discovery_confirm(), irlmp_do_discovery(), sysctl_discovery, and sysctl_discovery_slots.

Referenced by ircomm_tty_state_idle(), ircomm_tty_state_search(), irda_discover_daddr_and_lsap_sel(), irda_getsockopt(), irlan_init(), and irlan_provider_state_info().

Here is the call graph for this function:

void irlmp_do_discovery int  nslots  ) 
 

Definition at line 700 of file irlmp.c.

References ASSERT, irlmp_cb::cachelog, discovery_t::charset, CS_ASCII, irlmp_cb::discovery_cmd, FALSE, hashbin_get_first(), hashbin_get_next(), irlmp_cb::hints, discovery_t::hints, irlmp_do_lap_event(), irlmp_expire_discoveries(), LAP_STANDBY, lap_cb::lap_state, irlmp_cb::links, LM_LAP_DISCOVERY_REQUEST, LMP_LAP_MAGIC, lap_cb::magic, discovery_t::name_len, discovery_t::nickname, NICKNAME_MAX_LEN, discovery_t::nslots, NULL, lap_cb::saddr, strlen, strncpy, sysctl_devname, sysctl_discovery_slots, WARNING, and __u16_host_order::word.

Referenced by irlmp_discovery_request(), and irlmp_discovery_timer_expired().

Here is the call graph for this function:

struct lsap_cb* irlmp_dup struct lsap_cb orig,
void *  instance
 

Definition at line 554 of file irlmp.c.

References FALSE, hashbin_find(), hashbin_insert(), init_timer(), IRDA_DEBUG, kmalloc(), memcpy, NULL, and irlmp_cb::unconnected_lsaps.

Referenced by iriap_connect_indication(), and irttp_dup().

Here is the call graph for this function:

__u8 irlmp_find_free_slsap void   ) 
 

Definition at line 1422 of file irlmp.c.

References ASSERT, irlmp_cb::free_lsap_sel, IRDA_DEBUG, irlmp_slsap_inuse(), LMP_MAGIC, LSAP_MAX, irlmp_cb::magic, and NULL.

Referenced by irlmp_open_lsap().

Here is the call graph for this function:

__u32 irlmp_get_daddr struct lsap_cb self  ) 
 

Definition at line 1498 of file irlmp.c.

References ASSERT, lsap_cb::lap, and NULL.

Referenced by irttp_get_daddr().

discovery_t* irlmp_get_discovery_response void   ) 
 

Definition at line 888 of file irlmp.c.

References ASSERT, discovery_t::charset, CS_ASCII, irlmp_cb::discovery_rsp, irlmp_cb::hints, discovery_t::hints, IRDA_DEBUG, discovery_t::name_len, discovery_t::nickname, NICKNAME_MAX_LEN, NULL, strlen, strncpy, sysctl_devname, and __u16_host_order::word.

Referenced by irlap_state_ndm(), and irlap_state_reply().

__u32 irlmp_get_saddr struct lsap_cb self  ) 
 

Definition at line 1490 of file irlmp.c.

References ASSERT, lsap_cb::lap, and NULL.

Referenced by irttp_get_saddr().

__u8 * irlmp_hint_to_service __u8 hint  ) 
 

Definition at line 1076 of file irlmp.c.

References HINT_COMM, HINT_COMPUTER, HINT_EXTENSION, HINT_FAX, HINT_FILE_SERVER, HINT_LAN, HINT_MODEM, HINT_OBEX, HINT_PDA, HINT_PNP, HINT_PRINTER, HINT_TELEPHONY, IRDA_DEBUG, kfree(), kmalloc(), NULL, S_ANY, S_COMM, S_END, S_LAN, S_OBEX, S_PRINTER, and S_TELEPHONY.

Here is the call graph for this function:

int __init irlmp_init void   ) 
 

Definition at line 75 of file irlmp.c.

References ENOMEM, FALSE, hashbin_new(), HB_GLOBAL, HZ, init_timer(), irlmp_start_discovery_timer(), kmalloc(), LMP_MAGIC, memset, NULL, spin_lock_init, strcpy, sysctl_devname, and sysctl_discovery_timeout.

Referenced by irda_init().

Here is the call graph for this function:

void irlmp_notify_client irlmp_client_t client,
hashbin_t log
 

Definition at line 825 of file irlmp.c.

References irlmp_client_t::callback1, irlmp_client_t::callback2, discovery_t::daddr, hashbin_get_first(), hashbin_get_next(), irlmp_client_t::hint_mask, discovery_t::hints, IRDA_DEBUG, NULL, and __u16_host_order::word.

Referenced by irlmp_discovery_confirm().

Here is the call graph for this function:

struct lsap_cb* irlmp_open_lsap __u8  slsap_sel,
notify_t notify,
__u8  pid
 

Definition at line 136 of file irlmp.c.

References ASSERT, ERROR, FALSE, hashbin_insert(), init_timer(), notify_t::instance, irlmp_find_free_slsap(), irlmp_next_lsap_state(), irlmp_slsap_inuse(), kmalloc(), LMP_LSAP_MAGIC, LMP_MAGIC, LSAP_ANY, LSAP_CONNLESS, LSAP_DISCONNECTED, irlmp_cb::magic, memset, NULL, and irlmp_cb::unconnected_lsaps.

Referenced by ircomm_open_lsap(), iriap_register_lsap(), and irttp_open_tsap().

Here is the call graph for this function:

__u32 irlmp_register_client __u16  hint_mask,
DISCOVERY_CALLBACK1  callback1,
DISCOVERY_CALLBACK2  callback2
 

Definition at line 1277 of file irlmp.c.

References irlmp_client_t::callback1, irlmp_client_t::callback2, irlmp_cb::clients, get_random_bytes(), hashbin_find(), hashbin_insert(), irlmp_client_t::hint_mask, IRDA_DEBUG, kmalloc(), and NULL.

Referenced by ircomm_tty_ias_register(), irda_create(), and irlan_init().

Here is the call graph for this function:

void irlmp_register_link struct irlap_cb irlap,
__u32  saddr,
notify_t notify
 

Definition at line 258 of file irlmp.c.

References ASSERT, lap_cb::daddr, DEV_ADDR_ANY, ERROR, hashbin_insert(), hashbin_new(), HB_GLOBAL, lap_cb::idle_timer, init_timer(), notify_t::instance, irda_notify_init(), lap_cb::irlap, irlmp_next_lap_state(), kmalloc(), LAP_STANDBY, irlmp_cb::links, LMP_LAP_MAGIC, LMP_MAGIC, lap_cb::lsaps, lap_cb::magic, irlmp_cb::magic, memset, NULL, and lap_cb::saddr.

Referenced by irlap_open().

Here is the call graph for this function:

__u32 irlmp_register_service __u16  hints  ) 
 

Definition at line 1205 of file irlmp.c.

References get_random_bytes(), hashbin_find(), hashbin_insert(), irlmp_service_t::hints, irlmp_cb::hints, IRDA_DEBUG, kmalloc(), NULL, irlmp_cb::services, and __u16_host_order::word.

Referenced by ircomm_tty_ias_register(), irda_bind(), irda_setsockopt(), iriap_init(), and irlan_init().

Here is the call graph for this function:

__u16 irlmp_service_to_hint int  service  ) 
 

Definition at line 1152 of file irlmp.c.

References __u16_host_order::byte, HINT_COMM, HINT_COMPUTER, HINT_EXTENSION, HINT_LAN, HINT_OBEX, HINT_PDA, HINT_PNP, HINT_PRINTER, HINT_TELEPHONY, IRDA_DEBUG, S_ANY, S_COMM, S_COMPUTER, S_LAN, S_MODEM, S_OBEX, S_PDA, S_PNP, S_PRINTER, S_TELEPHONY, and __u16_host_order::word.

Referenced by ircomm_tty_ias_register(), irda_bind(), iriap_init(), and irlan_init().

int irlmp_slsap_inuse __u8  slsap_sel  ) 
 

Definition at line 1370 of file irlmp.c.

References ASSERT, FALSE, hashbin_get_first(), hashbin_get_next(), IRDA_DEBUG, irlmp_cb::links, LMP_LAP_MAGIC, LMP_LSAP_MAGIC, LMP_MAGIC, LSAP_ANY, LSAP_CONNLESS, LSAP_MAX, lap_cb::lsaps, lsap_cb::magic, lap_cb::magic, irlmp_cb::magic, NULL, lsap_cb::slsap_sel, and TRUE.

Referenced by irlmp_find_free_slsap(), and irlmp_open_lsap().

Here is the call graph for this function:

void irlmp_status_indication LINK_STATUS  link,
LOCK_STATUS  lock
 

Definition at line 1065 of file irlmp.c.

References IRDA_DEBUG.

Referenced by irlap_status_indication().

void irlmp_status_request void   ) 
 

Definition at line 1060 of file irlmp.c.

References IRDA_DEBUG.

void irlmp_udata_indication struct lsap_cb self,
struct sk_buff skb
 

Definition at line 970 of file irlmp.c.

References ASSERT, dev_kfree_skb, notify_t::instance, IRDA_DEBUG, LMP_HEADER, LMP_LSAP_MAGIC, lsap_cb::magic, lsap_cb::notify, NULL, and notify_t::udata_indication.

Referenced by irlmp_link_data_indication(), and irlmp_state_dtr().

int irlmp_udata_request struct lsap_cb self,
struct sk_buff skb
 

Definition at line 951 of file irlmp.c.

References ASSERT, IRDA_DEBUG, irlmp_do_lsap_event(), LM_UDATA_REQUEST, LMP_HEADER, and NULL.

Referenced by irttp_udata_request().

Here is the call graph for this function:

int irlmp_unregister_client __u32  handle  ) 
 

Definition at line 1342 of file irlmp.c.

References irlmp_cb::clients, hashbin_find(), hashbin_remove(), IRDA_DEBUG, kfree(), and NULL.

Referenced by ircomm_tty_detach_cable(), irda_destroy_socket(), and irlan_cleanup().

Here is the call graph for this function:

void irlmp_unregister_link __u32  saddr  ) 
 

Definition at line 305 of file irlmp.c.

References ASSERT, irlmp_cb::cachelog, del_timer(), hashbin_remove(), lap_cb::idle_timer, IRDA_DEBUG, irlmp_expire_discoveries(), kfree(), irlmp_cb::links, LMP_LAP_MAGIC, lap_cb::magic, NULL, lap_cb::saddr, and TRUE.

Referenced by irlap_close().

Here is the call graph for this function:

int irlmp_unregister_service __u32  handle  ) 
 

Definition at line 1238 of file irlmp.c.

References hashbin_find(), hashbin_get_first(), hashbin_get_next(), hashbin_remove(), irlmp_cb::hints, IRDA_DEBUG, kfree(), NULL, irlmp_cb::services, and __u16_host_order::word.

Referenced by ircomm_tty_detach_cable(), irda_destroy_socket(), irda_setsockopt(), iriap_cleanup(), and irlan_cleanup().

Here is the call graph for this function:

int irlmp_update_client __u32  handle,
__u16  hint_mask,
DISCOVERY_CALLBACK1  callback1,
DISCOVERY_CALLBACK2  callback2
 

Definition at line 1314 of file irlmp.c.

References irlmp_client_t::callback1, irlmp_client_t::callback2, irlmp_cb::clients, hashbin_find(), irlmp_client_t::hint_mask, IRDA_DEBUG, and NULL.

Referenced by irda_discover_daddr_and_lsap_sel(), and irda_getsockopt().

Here is the call graph for this function:


Variable Documentation

struct irlmp_cb* irlmp = NULL
 

Definition at line 46 of file irlmp.c.

Referenced by discovery_proc_read(), irlmp_add_discovery(), irlmp_discovery_timer_expired(), irlmp_find_device(), irlmp_find_lsap(), irlmp_link_data_indication(), irlmp_link_discovery_confirm(), irlmp_link_discovery_indication(), irlmp_state_active(), irlmp_state_connect(), irlmp_state_setup_pend(), and irlmp_state_standby().

char* lmp_reasons[]
 

Initial value:

 {
        "ERROR, NOT USED",
        "LM_USER_REQUEST",
        "LM_LAP_DISCONNECT",
        "LM_CONNECT_FAILURE",
        "LM_LAP_RESET",
        "LM_INIT_DISCONNECT",
        "ERROR, NOT USED",
}

Definition at line 54 of file irlmp.c.

char sysctl_devname[65]
 

Definition at line 52 of file irlmp.c.

Referenced by irlan_ias_register(), irlmp_do_discovery(), irlmp_get_discovery_response(), and irlmp_init().

int sysctl_discovery = 0
 

Definition at line 49 of file irlmp.c.

int sysctl_discovery_slots = 6
 

Definition at line 51 of file irlmp.c.

int sysctl_discovery_timeout = 3
 

Definition at line 50 of file irlmp.c.