summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_LlcpTransport.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed FRMR sending on invalid LLCP frame receivedSunil Jogi2012-02-061-2/+2
| | | | | | | DSAP and SSAP were switched on with the other at multiple location in the code. This patch fix those. Change-Id: Iea8e499049a2cd4a234155a3044b875eb9c6ca7a
* Handle inbound buffering in LLCP connectionless socketsSunil Jogi2012-01-301-39/+84
| | | | | | | | This enables the server to avoid losing packets, especially when receiving them in an aggregated packet. The size of the buffer is determined by the size of the working buffer provided by the application. Change-Id: Ia3c72e19fdb74e2a43390af5607c497c2275fe46
* LLCP 1.1: Fix some bugs.Martijn Coenen2012-01-271-3/+8
| | | | | | | - 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-48/+677
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+277
| | | | | | | | | | | | | 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
* Factorized and fixed code for automatic LLCP socket binding.Sylvain Fonteneau2011-07-251-18/+41
| | | | | | | | | Fixed the SAP automatic allocation algorithm which could previously allocate the same SAP twice in some situations (e.g.: if first socket in socket table was bound to SAP 0x21 and second socket to 0x20, then autobind was allocating SAP 0x21 again). Change-Id: Ic94bbc7eaca260c69cb0ce22931e9241f459bbf5
* Check SAP range in LLCP sockets.Sylvain Fonteneau2011-07-041-11/+48
| | | | | | | | | | | LLCP specification mentions that SAP numbers are allocated as follows: - from 0x00 to 0x0F, used for well-known services - from 0x10 to 0x1F, used for SDP advertised services - from 0x20 to 0x3F, used for *non* SDP advertised services This patch enforce this restriction. Change-Id: Idd8ab4da4cfa9ad9e2dbf7eddc3c66900bcf9ff8
* 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
* Fixed LLCP send callback triggering.Arnaud Ferir2011-01-181-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Removed callback in case of immediate end of operation.Arnaud Ferir2011-01-181-120/+53
| | | | | | | | | | | | 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
* Fixed parameters checking in LLCP.Arnaud Ferir2011-01-181-2/+6
| | | | | | Avoid NULL pointer dereferencing in some situations. Change-Id: I020f0a5342acdc49f7f3804e9341ed0fc0f307ee
* Allow LLCP socket creation before link establishment.Arnaud Ferir2011-01-181-1/+18
| | | | | | | | | | | | | | | | | 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
* Enable reading a connection-oriented socket even if remotely closed.Sylvain Fonteneau2010-12-131-1/+1
| | | | | | | 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
* Close all LLCP sockets when the link goes down.Sylvain Fonteneau2010-12-051-0/+22
| | | | | | | | 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
* Fixed LLCP socket options storage.Sylvain Fonteneau2010-11-011-7/+8
| | | | | | | | 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-1/+7
| | | | | | | 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/+1296
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>