History log of /external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3cbab5882f6d89a52068a3fa72a7223971d6b7fd 06-Mar-2013 Martijn Coenen <maco@google.com> Make sure LLCP header fields are reset.

In some conditions these would persist
over a link tear-down, causing them to
be sent out the next time the link comes up.

Also, don't overwrite them if a send is
still in progress.

Change-Id: I19dec5d79ae4b25f41fb5e8a0514e565ceca7a91
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
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_Connection.c
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_Connection.c
ce7e8806d59161969589c46abbef8ed1436cea8f 04-Feb-2012 Sunil Jogi <sunil.jogi@nxp.com> Fixed FRMR sending on invalid LLCP frame received

DSAP and SSAP were switched on with the other at multiple location
in the code. This patch fix those.

Change-Id: Iea8e499049a2cd4a234155a3044b875eb9c6ca7a
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
00485a32cdb11d9773d9800aa374f16560a9d41e 30-Jan-2012 Sunil Jogi <sunil.jogi@nxp.com> Fixed rejected receive request in LLCP

If phLibNfc_Llcp_Recv() is called in the callback of a previous
phLibNfc_Llcp_Recv(), it could be rejected due to the
bSocketRecvPending flag which was not properly reset.

Change-Id: I6c41469480b50bb7adc9a721ec96f715e5d56a60
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
ffdbd5c4c6574af205d7bb657c9aec025db6e8ac 27-Jan-2012 Sunil Jogi <sunil.jogi@nxp.com> Reset LLCP socket internal variables before next use.

Some internal variables used in reveive window checkings were not
reset on socket closure/re-opening. This was leading to have the
send() function waiting forever for remote acknowledgments.

Change-Id: Ic7741b004de80af3f851f620842d46c42f654804
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
49adea74868aa2bac7b3f0a1c82be9d956d3a86e 27-Jan-2012 Sunil Jogi <sunil.jogi@nxp.com> Update for LLCP V(SA) internal variable

The V(SA) is an internal variable used in LLCP connection-oriented
data links to check receive window conditions. It corresponds to
the last frame number acknowledged by remote peer + 1.

The patch makes sure this variable is updated evry time it is needed.

Change-Id: Ie5ac925a6f1dfa19b22ac2b6e96659440d5daf21
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
d25018da04378bf0529f82ed03d9e25390216b0b 27-Jan-2012 Martijn Coenen <maco@google.com> LLCP 1.1: Fix some bugs.

- Clear out send callback if send was not accepted.
- Set transport busy status for RR/RNR frames.

Change-Id: Idf8986f6b82995644b176247a644e36d2c879ebf
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
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_Connection.c
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_Connection.c
379262748505107b88ec92675529063789e44da6 12-May-2011 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed LLCP receive function when accessing RW.

In some situations, the working buffer may be full and some packets
are stored in the receive window when trying to read from upper
layer.

In this case, the receive function first reads data from the working
buffer and if possible, also tries to read data stored in the receive
window. The previous receive window data extraction algorithm could
lead to an infinite loop. With this fix, we can ensure that this won't
happen any more.

Change-Id: Iddb412213f4e9cb5fb42691bd282dbf0a21a936e
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
45101265f65461385bd7c81db0bfc84b334df8e0 26-Jul-2011 Martijn Coenen <maco@google.com> Deal with LLCP send errors properly (part 1).

Send failures on LLCP sockets were not dealt with at all - the transport
was just left in a state where it thought there was a pending send
and a pending callback. Before we typically only did one send and
it didn't bite us so much, but now with multiple sockets we run
into this frequently.

This really just fixes part of the problem - we should also look
if state rollbacks are necessary, as those are not done either
on send failures.

Change-Id: I484ca598e043ead835251aedaabe47d3a1da7a8f
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
34ff48f6cd6595a899e05fbd56f4c84891840d3f 27-Jun-2011 Nick Pelly <npelly@google.com> libnfc spring cleaning

o Fix most libnfc warnings, from 360 to 18
o Make DAL_DEBUG much less verbose and more useful
o Clean up Android.mk

Done with minimal textual diff to minimize merge conflicts.

Change-Id: I918645500723ff7bb092ad9959628fcabac45bec
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
60d8ea84bfbf2dabd0e851edd812f89d42043c1a 18-May-2011 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Update V(RA) counter in LLCP sockets any time it is needed.

At some points, the V(RA) socket counter (used for Receive Window
checking in connection-oriented sockets) was not properly updated,
thus leading to sometimes reject (FRMR) inbound I-frames with valid
sequence numbers.

This patch factorize the I-frame emission and update V(RA) in the
factorized code to ensure this is done at any time.

Change-Id: Ic7ef92cb136c32e524a14e31a8d350f7b165c367
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
46dbed4e11700226e9b43ca17e5ad6f3d192bf63 04-Apr-2011 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Ignore unreadable TLVs during LLCP activation and CONNECT/CC.

The LLCP specification defines that if a TLV cannot be interpreted,
it shall be ignored rather than generating an error.

This patch removed all error reporting on TLV interpretation. The
only error that can still happen is length inconsistency in the
whole TLV array buffer.

Change-Id: Ibf289fceb2283bfddcdc0ddee9e687ece3e90887
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
28235f8b29ef8cc368dd132080245778cdf704cc 14-Jan-2011 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Erase callback when function returns immediately.

This should avoid calling a irrelevant callback at abort.

Change-Id: Ied8d54268613f248fd505d4b25d0ab8a0905a336
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
407d793f3038222dac95651866b99cd064e214eb 14-Jan-2011 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Fixed LLCP send callback triggering.

The phLibNfc_Llcp_Send() function is expected to trigger a callback
when the packet is actually sent but, in some situations, the callback
was triggered by another frame sending (such as RR or DM frames).

This patch fixes the following socket internal flags handling:
- pfSocketSend_Cb: set to non-NULL value when a send operation is
pending,
- bSocketSendPending: set to TRUE if the LLCP link layer is not
available for sending and reset to FALSE once the frame is
actually forwarded to the LLCP link layer.

The send callback triggering has been updated to ensure it is only
done for the expected data frame (i.e.: send pending and already
forwarded to link layer).

Change-Id: Id7410ee4075fbbbc9de382abf54e89a97f6a8b37
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
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_Connection.c
8608ad938da280b895e3bb71435d6fe34c589219 14-Jan-2011 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed LLCP receive window checkings.

Before sending a packet, the LLCP stack have to check if the remote
peer is ready to send. To do so, a Receive Window mechanism based on
packet numbering and acknowledgment is used.

Basically, the sender have to make sure that he must have not sent
more than RW-1 unaknowledged frames before sending a new one. This
patch is correcting this test which was failing in some situations.

Change-Id: I525f6b472a909ce48feb938aa02858b9456edc11
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
a3af9c908f5c50e2405169015c86a1b667b42490 11-Jan-2011 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Removed callback in case of immediate end of operation.

The correct behavior of asynchronous functions should be:
Immediate operation => function returns with success/error status,
callback never invoked
Delayed operation => function returns with pending status,
callback is invoked at the end of operation

Some minor fixes are also included in this commit (code style).

Change-Id: Ieb801ab759045c5c5d9fc59b4715f3c142d5b33e
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
f546a14a4509e1814bfd94fc76cdfa2252dc455c 07-Jan-2011 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Do not call LLCP socket listen callback on abort.

The listen callback is a notification callback, not an
end-of-operation callback so, when the socket is closed,
it should not be triggered since there is no connection
event.

Change-Id: I6e6994f6bcb09f9fadda04800d22528d76aff121
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
44835562edd67f15196a47631a384afb1d8b8068 07-Jan-2011 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Fixed NULL pointer error when trying to send LLCP REJECT frame.

The sequence value may not be provided in some situations, when
rejecting a connection oriented frame.

Change-Id: I116179191f9a23072442cf9da7a4c4207128bd32
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
1ec4ace9cd3079abd7c0b30d0976591c8c0f441e 15-Dec-2010 Arnaud Ferir <arnaud.ferir@trusted-logic.com> Call the LLCP send callback in error cases.

This avoids an application to be stuck in a send request while the
LLCP link has been lost (i.e. remote peer lost).

Change-Id: I74982d497c410ae4bdb466afac013efc9eb17b03
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
04f25b3ab4ed13edb3ffc8e7354bca9f7bc60b44 02-Nov-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Enable reading a connection-oriented socket even if remotely closed.

The receive function was failing when trying to read the data present in
the linear buffer after receiving a remote disconnection request (DISC).

Change-Id: I48a2aa058e85e265ca53e61dcde281e47a6e187f
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
bc161ef03aa21063091a69c36a0163306640468f 13-Dec-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Do not clear LLCP listen callback when an incoming socket is detected.

This would prohibit detection of multiple incoming socket in a row.

Change-Id: I9e3907a92b706de2da7642ccd92668b9868d1996
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
b2c5ac1e2d4dda413c4b3a66dc8a186e1dc5f6c4 02-Dec-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Avoid multiple callbacks for a single LLCP operation.

Change-Id: Ifa17a3a05790fece3f5aee747b186f721c510b7f
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
8a4742c9dfa8010c06e5c746ab739ed71ba327bd 01-Dec-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fix to prevent any action on a LLCP socket while disconnecting.

Mark a socket as disconnecting as soon as the disconnect request is received
instead of waiting for the DISC packet to be sent.

Change-Id: I95330b7039c6fa741adc69ab1323852a60b7d49e
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
1c75e8952d88d81c5f04826f69ca22d14bb5683b 26-Nov-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Call the callback of any pending action in case of LLCP socket closure.

This ensure the lib client not to be stuck waiting for a callback when
the socket has been closed meanwhile.

Change-Id: I9cdfa3c2cc75ee9451c3ad5b92eb338b5e68f53a
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
fb709589632b4962b88113346316ec53a574258b 23-Nov-2010 Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> Fixed status handling in LLCP connection-oriented sent callback.

The same variable was shared for multiple usages and the status value
was overwritten is some situations. One variable is now defined for
each usage.

Change-Id: I877cc8027a184dfe3b6d8d2832c73417f40c1ba7
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
e1c9fcfb918da43ab24f95c9341da3b6bf3b1250 01-Nov-2010 Jeff Hamilton <jham@android.com> Fix the parameters to phFriNfc_Llcp_EncodeMIUX.

Change-Id: Ia0426198d0edd325edcc2bb5a3c6d7d623e28a9f
/external/libnfc-nxp/src/phFriNfc_LlcpTransport_Connection.c
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_Connection.c
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_Connection.c
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_Connection.c