History log of /external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
837efc3194a03beaaa32b370c63a9270ed9664d8 06-Mar-2013 Martijn Coenen <maco@google.com> Fix wrong callback being cleared.

When a call to disconnect() failed, the
connect() callback was cleared, not the
disconnect() one. This would cause deadlocks,
where JNI threads were forever blocked on
doConnect().

Bug: 7324226
Change-Id: I784c8d700c87d643315f2417610ca75ef8f9aa7c
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
7c4b4fadb66959c50c170182847886e83393eebf 02-Mar-2013 Martijn Coenen <maco@google.com> Fix some LLCP threading issues.

On Android we now start connecting SNEP/other LLCP
services as soon as the link comes up. That means
we will have connect requests incoming, accept
responses outgoing, connect requests outgoing and
accept responses incoming.

This lays bare a lot of threading issues in this lib.
Since the receives come in serialized, those typically
do not cause any issue. However, we may be sending
something on a thread coming from the NfcService,
while at the same time we'll receive for example
a connect frame from the remote, to which the receive
thread immediately wants to send a response.

This is a first attempt at making sends thread-safe:
already there was a lot of logic to deal with the fact
that another send was in progress, in the form of the
bSendPending variable. That variable was however
not checked atomically, and some operations did not
even set it correctly.

This change tests and sets that variable atomically,
more or less implementing a semaphore with try-acquires
and fallbacks for the failure case.

The generic structure is:

if (testAndSetSendPending()) {
// Another thread is sending, stash data
// and most importantly do *NOT* change shared data
} else {
// We're now the only one sending, we're free
// to change shared data until the callback is
// called.
}

This is just a band-aid fix, but given the fact that
this stack will be deprecated it is hopefully enough
for our planned usecases.

A decent fix would involve switching to
a TX-queue per socket, and a generic TX-queue
for the whole LLCP link. This allows us to fully
decouple the connection layer from the transport
layer, as it should be.

Change-Id: Ibd8742f7350a58459771f5036a049af3a487f783
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767 16-Jan-2012 Sunil Jogi <sunil.jogi@nxp.com> LLCP 1.1 implementation.

Previously, in LLCP v1.0, the only way to use the SDP (Service
Discovery Protocol) service was to send a CONNECT frame containing
the Service Name to the SDP service. This was implicitly
preforming a connection request to the requested service.

LLCP v1.1 introduced a way to discover services more efficiently
and without implicit connection. It also enables connectionless
services to have a service name. It is based on a new protocol
based on a new SNL frame containing discovery requests and
responses.

This update comes with new APIs:
- phLibNfc_Llcp_DiscoverServices() function can be used to discover
remote services. It can take multiple service names and resolve
all of them in a single call.

- Register service name at bind time. Cache LLCP service name/sap pairs.
In LLCP 1.1 specification defines at section 5.9 that any service
lookup answer must be valid for the whole LLCP session duration.
To enforce this, we cache the SAP/SN pairs locally and make sure
that the applications don't break the cache.

The stack remains fully retro-compatible with v1.0 devices.

Change-Id: I052edd3838013cee65e7415d0ed01fc3e9cad36d
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
955a8efe369ece977e4757f0ae37b3931169125b 16-Jan-2012 Sunil Jogi <sunil.jogi@nxp.com> LLCP 1.1: allow pending operations on connectionless.

The pending operations were handled at the connection-oriented sockets
level, with no possibility for other transport types to handle
pending operations.

A dispatcher has been added at the generic transport level to
remove this limitation.

This feature is needed to implement LLCP v1.1.

Change-Id: I69e37ba800d1c531396ca97ab0a0480e0f53d63f
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
42fd1ffc1f8f87e7faca1724d128dafa70ff3b1e 14-Jan-2011 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed erroneous LLCP frame on socket closure.

Moved data allocation from stack memory to heap in order
to avoid invalid memory access.

Previously, When trying to send a DM (acknowledgment to
socket disconnect request), the stack was allocating some
frame data on the stack but these data were used after the
function returned.

Other calls to the same function are already using variables
allocated on heap.

Change-Id: Id7356a876fdecdd979ed3ddc6dbe100d6e92d43d
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
76270e7c32ec0c558907430e756712d5b68b417c 21-Dec-2010 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Allow LLCP socket creation before link establishment.

This enables to register a server socket prior to LLCP link
establishement and avoid any race condition between the local
server and the remote client.

The modification implies a LLCP socket API change (added the
device handle parameter in all LLCP API that can lead to
active data exchange). The LLCP socket internal structures are
now initialized during LLCP link parameter configuration step
instead of LLCP compliancy check to save socket state
independently from peer detection.

Also removed unused socket states and added some traces.

Change-Id: I961c48af4ca9ace68d41b9569dc1038bb2bbdc71
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
c56a3c7bc332a6656bedf342236267b636051170 29-Nov-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Close all LLCP sockets when the link goes down.

The LLCP link status callback is now handled first in LIB layer
before being forwarded to the client. This is needed to enable the LIB layer
to detect the link status change and close the sockets accordingly.

Change-Id: I607aaebb4c0c8f2da09c81d4d43b4c705ebfcb13
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
c2866714540bec65af19240e95a10d3090df0cf9 02-Nov-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed LLCP socket options storage.

Socket options are now copied in the libnfc to avoid referencing a pointer that
may not be valid during the whole socket life cycle.

Change-Id: I7266164bf157242df1ce7fb7a0f9cffd52938140
Signed-off-by: Nick Pelly <npelly@google.com>
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
cf5cd1520ea32d2b65712a36a105f396df07345c 28-Oct-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed LLCP Service Name matching failure.

Service Name is now copied in the libnfc to avoid referencing a pointer that
may not be valid during the whole socket life.

Change-Id: I6572366ac51502d189cc8f1350fa089c11cc2bea
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h
5d9927ba30ba449badb9f6df0fbeb4d6aedc6e2a 23-Sep-2010 Nick Pelly <npelly@google.com> Initial libnfc checkin

Source: Trusted_NFC_Device_Host_AA03.01e02_google.zip code drop (23-Sep-2010)

Change-Id: Ie47f18423f949a8d3e0815d13f55c814312add24
Signed-off-by: Nick Pelly <npelly@google.com>
/external/libnfc-nxp/src/phFriNfc_LlcpTransport.h