summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_LlcpTransport_Connection.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed FRMR sending on invalid LLCP frame receivedSunil Jogi2012-02-061-10/+10
| | | | | | | DSAP and SSAP were switched on with the other at multiple location in the code. This patch fix those. Change-Id: Iea8e499049a2cd4a234155a3044b875eb9c6ca7a
* Fixed rejected receive request in LLCPSunil Jogi2012-01-301-1/+1
| | | | | | | | 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
* Reset LLCP socket internal variables before next use.Sunil Jogi2012-01-271-0/+6
| | | | | | | | 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
* Update for LLCP V(SA) internal variableSunil Jogi2012-01-271-6/+3
| | | | | | | | | | 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
* LLCP 1.1: Fix some bugs.Martijn Coenen2012-01-271-0/+6
| | | | | | | - Clear out send callback if send was not accepted. - Set transport busy status for RR/RNR frames. Change-Id: Idf8986f6b82995644b176247a644e36d2c879ebf
* LLCP 1.1 implementation.Sunil Jogi2012-01-271-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* LLCP 1.1: allow pending operations on connectionless.Sunil Jogi2012-01-271-444/+215
| | | | | | | | | | | | | 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
* Fixed LLCP receive function when accessing RW.Sylvain Fonteneau2011-07-251-21/+20
| | | | | | | | | | | | | | 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
* Deal with LLCP send errors properly (part 1).Martijn Coenen2011-07-251-51/+26
| | | | | | | | | | | | | | 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
* libnfc spring cleaningNick Pelly2011-06-271-1/+1
| | | | | | | | | | 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
* Update V(RA) counter in LLCP sockets any time it is needed.Sylvain Fonteneau2011-06-031-173/+56
| | | | | | | | | | | | 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
* Ignore unreadable TLVs during LLCP activation and CONNECT/CC.Sylvain Fonteneau2011-04-081-3/+9
| | | | | | | | | | | 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
* Erase callback when function returns immediately.Arnaud Ferir2011-01-181-6/+47
| | | | | | This should avoid calling a irrelevant callback at abort. Change-Id: Ied8d54268613f248fd505d4b25d0ab8a0905a336
* Fixed LLCP send callback triggering.Arnaud Ferir2011-01-181-7/+4
| | | | | | | | | | | | | | | | | | | 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
* Fixed erroneous LLCP frame on socket closure.Sylvain Fonteneau2011-01-181-13/+9
| | | | | | | | | | | | | | | 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
* Fixed LLCP receive window checkings.Sylvain Fonteneau2011-01-181-6/+6
| | | | | | | | | | | | 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
* Removed callback in case of immediate end of operation.Arnaud Ferir2011-01-181-23/+19
| | | | | | | | | | | | 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
* Do not call LLCP socket listen callback on abort.Arnaud Ferir2011-01-181-6/+2
| | | | | | | | | 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
* Fixed NULL pointer error when trying to send LLCP REJECT frame.Arnaud Ferir2011-01-181-2/+5
| | | | | | | The sequence value may not be provided in some situations, when rejecting a connection oriented frame. Change-Id: I116179191f9a23072442cf9da7a4c4207128bd32
* Call the LLCP send callback in error cases.Arnaud Ferir2011-01-181-0/+5
| | | | | | | 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
* Enable reading a connection-oriented socket even if remotely closed.Sylvain Fonteneau2010-12-131-0/+14
| | | | | | | 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
* Do not clear LLCP listen callback when an incoming socket is detected.Sylvain Fonteneau2010-12-131-2/+0
| | | | | | This would prohibit detection of multiple incoming socket in a row. Change-Id: I9e3907a92b706de2da7642ccd92668b9868d1996
* Avoid multiple callbacks for a single LLCP operation.Sylvain Fonteneau2010-12-071-4/+7
| | | | Change-Id: Ifa17a3a05790fece3f5aee747b186f721c510b7f
* Fix to prevent any action on a LLCP socket while disconnecting.Sylvain Fonteneau2010-12-071-3/+3
| | | | | | | 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
* Call the callback of any pending action in case of LLCP socket closure.Sylvain Fonteneau2010-12-051-12/+52
| | | | | | | This ensure the lib client not to be stuck waiting for a callback when the socket has been closed meanwhile. Change-Id: I9cdfa3c2cc75ee9451c3ad5b92eb338b5e68f53a
* Fixed status handling in LLCP connection-oriented sent callback.Sylvain Fonteneau2010-12-051-9/+10
| | | | | | | | 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
* Fix the parameters to phFriNfc_Llcp_EncodeMIUX.Jeff Hamilton2010-11-021-8/+8
| | | Change-Id: Ia0426198d0edd325edcc2bb5a3c6d7d623e28a9f
* Fixed LLCP socket options storage.Sylvain Fonteneau2010-11-011-16/+18
| | | | | | | | 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>
* Fixed LLCP Service Name matching failure.Sylvain Fonteneau2010-10-281-8/+25
| | | | | | | 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
* Initial libnfc checkinNick Pelly2010-09-231-0/+2765
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>