---
name: "irda"
section: "7"
platform: "linux"
package: "irda-utils"
version: "0.9.18-15"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/irda"
---

# irda(7)

The Linux-IrDA protocol stack

## NAME

irda - The Linux-IrDA protocol stack

## SYNOPSIS

**#include \<linux/irda.h\>**\

*stream\_s* **= socket(PF\_INET, SOCK\_STREAM, 0);**\
 *seqpkt\_s* **= socket(PF\_INET, SOCK\_SEQPACKET, 0);**\
 *dgram\_s* **= socket(PF\_INET, SOCK\_DGRAM, IRDAPROTO\_UNITDATA);**\
 *ultra\_s* **= socket(PF\_INET, SOCK\_DGRAM, IRDAPROTO\_ULTRA);**

## DESCRIPTION

**Linux-IrDA** is a complete implementation of the various *IrDA protocols* and *IrDA drivers* for Linux.

The configuration of the low level of the IrDA stack (IrDA ports) and the various IrDA drivers are described in [*irattach*(8)](/irattach/8.md).

The usage of the higher layers of the IrDA stack (IrCOMM, IrLPT, IrNET, IrLAN, OBEX...) are described in their respective man pages.

The core of the Linux-IrDA protocol stack is composed of the *IrLAP*, *IrLMP*, *IrTTP* and *IrIAS* protocols and is implemented as a kernel module. The programmer's interface for the IrDA stack is socket based. For more information on sockets, see [socket(7)](/socket/7.md).

Note that higher level IrDA protocols may offer a different programmer's interface. For example *IrCOMM* offers a TTY based interface and *OBEX* is available through a user space library.

## SOCKETS TYPE

The Linux-IrDA socket interface offers 4 types of sockets:

- **Stream socket - SOCK\_STREAM, 0**

  Stream sockets provides a reliable, stream oriented, full duplex connection between two sockets on top of *IrTTP*, similar to TCP sockets. IrTTP guarantees that the data arrives in order and manages flow contol, IrLAP retransmits lost packets.\
   Stream sockets does not preserve record boundaries.

- **SeqPacket socket - SOCK\_SEQPACKET, 0**

  SeqPacket sockets provides a reliable, datagram oriented, full duplex connection between two sockets on top of *IrTTP*. IrTTP guarantees that the data arrives in order and manages flow contol, IrLAP retransmits lost packets.\
   SeqPacket sockets preserve record boundaries. Large datagrams will be fragmented as needed.

- **Datagram socket - SOCK\_DGRAM, IRDAPROTO\_UNITDATA**

  SeqPacket sockets provides a reliable, datagram oriented, full duplex connection between two sockets on top of *IrLMP*. There is no guarantees that the data arrives in order and there is no flow contol, however IrLAP retransmits lost packets.\
   Datagram sockets preserve record boundaries. No fragmentation is provided, datagrams larger than the IrDA link MTU are truncated or discarded.

- **Ultra socket - SOCK\_DGRAM, IRDAPROTO\_ULTRA**

  Ultra sockets provides a connectionless, unreliable datagram packet service on top of *IrLAP-Ultra*. Ultra datagrams are sent and receive only when no IrLAP connection is established and otherwise discarded. They are always transmitted at 9600 bauds. Datagrams may be lost, reordered, and there is no flow control.\
   Ultra sockets preserve record boundaries. No fragmentation is provided, datagrams larger than the Ultra MTU (382 bytes) are truncated or discarded.

## ADDRESS FORMAT

An  **IrDA socket address** is defined as a combination of an IrDA interface address and a *service name*. Service names are automatically resolved to lsap through the *IrIAP* protocol.

```
    struct sockaddr_irda {
        sa_family_t sir_family;   /* AF_IRDA */
        __u8        sir_lsap_sel; /* LSAP selector */
        __u32       sir_addr;     /* Device address */
        char        sir_name[25]; /* Usually <service>:IrDA:TinyTP */
    };
```

*sin\_family* is always set to AF\_IRDA. *sir\_lsap\_sel* is usually not used. *sir\_addr* is the address of the peer and optional (and that case the first peer discoverd will be used). *sir\_name* is the service name of the socket.

## SOCKET OPTIONS

IrDA sockets supports some protocol specific socket options that can be set with [*setsockopt*(2)](/setsockopt/2.md) and read with [*getsockopt*(2)](/getsockopt/2.md). The socket option level for IrDA is SOL\_IRLMP.

Options that can be set:

- **IRLMP\_IAS\_SET**

  Set an entry in the local IAS database.

- **IRLMP\_IAS\_DEL**

  Delete an entry from the local IAS database.

- **IRLMP\_MAX\_SDU\_SIZE**

  Set maximum receive MTU for SeqPacket sockets.

- **IRLMP\_HINTS\_SET**

  Set IrDA hint bits to be advertised to peers.

- **IRLMP\_HINT\_MASK\_SET**

  Set IrDA hint bits filter to be used when performing discovery.

Options that can be get:

- **IRLMP\_ENUMDEVICES**

  Perform link level discovery and return the content of the discovery log.

- **IRLMP\_MAX\_SDU\_SIZE**

  Get maximum receive MTU.

- **IRLMP\_IAS\_GET**

  Get an entry from the local IAS database.

- **IRLMP\_IAS\_QUERY**

  Query an entry in IAS database of a peer using IrIAP.

- **IRLMP\_WAITDEVICE**

  Block until a new device is discovered. Experimental feature, use with caution.

## AUTHOR

Jean Tourrilhes - jt@hpl.hp.com

## SEE ALSO

[**irattach**(8)](/irattach/8.md), [**irdadump**(8)](/irdadump/8.md), [**irnet**(4)](/irnet/4.md), **irnetd**(8).
