Bug 995202: 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>
Bug 995202: 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>
Bug 995202: Cleanup NFC buffer reading/writing

This patch adds a nice API around NFC-internal buffers.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Merge pull request #72 from tdz/bug-995202

Bug 995202
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 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
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 messages
Added SNEP PUT sending and receiving
Bug 900851: Added base64 encoding and decoding

To be compatible with all terminals, we'll need base64 encoding for
strings that are read or written on the emulator's console. This
patch adds encoding and edecoding routines for base64.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Added SNEP PUT console command
move base64 out of console
added automatic LLCP connect to SNEP put
Clear NFC remote endpoint on activation

Some internal state needs to be cleared before the RE structure
can be used. We do this at activation time.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>