Pass NCI payload size to callback functions

The NCI payload buffer is limited to 256 bytes, so it can easily
overflow. The callback function for creating NCI payload now
receives a parameter that contains the remaining buffer size.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Rename LLCP packets to PDUs

The LLCP specification calls individual LLCP messages 'PDUs', so
we should too.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Added LLCP SAP constants to NFC emulation

The SAP constants contain magic numbers for the Service Access
Points of LLCP, as defined by the NFC forum.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Introduce LLCP data links

According to the LLCP specification, data links transfer data between
two Service Access Points; either in a connected or unconnected mode.

This patch introduces the data structure llcp_data_link to represent
data links. It replaces the llcp_connection_state structure, which had
a similar purpose, but could incorrectly named and could not deal with
LLCP conncetions.
added llcp_clear_dl
Added infrastructure for sending LLCP PDUs in NCI packets

LLCP peers mutually pass send permission, and LLCP requires PDUs
to be sent at specific points when the peer has the permission to
do so. If no PDUs are available for transmission, a SYMM PDU has
to be sent for passing permissions to the other peer.

This patch adds the necessary infrastructure to inject LLCP PDUs
into the stream of SYMM PDUs. If the user creates a new LLCP PDU
it is either

  - send immediatelly if the peer has permisison to do so, or
  - queued up to be sent when permission has been received.

Just as before, if no PDUs are queued up, a SYMM PDU will be sent
after a timeout has been reached. Sending a PDU also passes send
permission to the peer.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Implement LLCP PDUs for connection handling

This patch adds support for processing connection-related LLCP
PDUs that was previously missing. The PDUs include

  - CONNECT for connection requests,
  - DISC for disconnection requests,
  - CC for signalling successful connection requests, and
  - DM for signalling failed of ended connections.
Added llcp connect command to emulator console

The emulator console now accepts commands for sending LLCP CONNECT
PDUs to the guest system. This feature is not for regular users or
test cases, but only for testing the internals of the emulator!

A possible command looks like

  nfc llcp connect 4 4

where the trailing numbers are the indices of the DSAP and SSAP
Service Access Points. In this example the command would connect
the SAPs for SNEP, which are used for transfering NDEF messages.
SAP numbers are standardized by the NFC Forum.
added debugging
cleanup buffer reading/writing
fix send command
support read command on console
NCI debug
added LLCP PUDs support for sending data
Added SNEP protocol

The Simple NDEF Exchange Protocol is a high-level protocol for
transfering NDEF records between two NFC peers, with 'put' and
'get' primitives similar to HTTP. The current support for SNEP
includes 'put' and some response codes that are necessary for
sending NDEF records.
implemeneted SNEP SAP
added NDEF
added SNEP put sending
Added SNEP console command
added automatic LLCP connect to SNEP put