summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_LlcpTransport_Connection.c
diff options
context:
space:
mode:
authorSunil Jogi <sunil.jogi@nxp.com>2012-01-16 11:50:07 -0800
committerMartijn Coenen <maco@google.com>2012-01-27 12:16:14 -0800
commit7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767 (patch)
tree28f717e57bc399f50c36ab278355b441402d30e9 /src/phFriNfc_LlcpTransport_Connection.c
parent955a8efe369ece977e4757f0ae37b3931169125b (diff)
downloadexternal_libnfc-nxp-7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767.zip
external_libnfc-nxp-7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767.tar.gz
external_libnfc-nxp-7b187e70a5f0ffc021cc06a9f1a2bf2c0f8f8767.tar.bz2
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
Diffstat (limited to 'src/phFriNfc_LlcpTransport_Connection.c')
-rw-r--r--src/phFriNfc_LlcpTransport_Connection.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/phFriNfc_LlcpTransport_Connection.c b/src/phFriNfc_LlcpTransport_Connection.c
index f58b33f..a11945f 100644
--- a/src/phFriNfc_LlcpTransport_Connection.c
+++ b/src/phFriNfc_LlcpTransport_Connection.c
@@ -1581,7 +1581,6 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_SocketGetRemoteOptions(phFri
*
*
* \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
-* \param[in] psServiceName A pointer to a Service Name
* \param[in] pListen_Cb The callback to be called each time the
* socket receive a connection request.
* \param[in] pContext Upper layer context to be returned in
@@ -1595,37 +1594,11 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_SocketGetRemoteOptions(phFri
* \retval NFCSTATUS_FAILED Operation failed.
*/
NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Listen(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
- phNfc_sData_t *psServiceName,
pphFriNfc_LlcpTransportSocketListenCb_t pListen_Cb,
void* pContext)
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
uint8_t index;
-
- /* Check if the service name is already registered */
- if (psServiceName != NULL)
- {
- for(index=0;index<PHFRINFC_LLCP_NB_SOCKET_MAX;index++)
- {
- phFriNfc_LlcpTransport_Socket_t* pCurrentSocket = &pLlcpSocket->psTransport->pSocketTable[index];
-
- if((pCurrentSocket->sServiceName.length == 0) ||
- (pCurrentSocket->eSocket_State != phFriNfc_LlcpTransportSocket_eSocketRegistered))
- {
- /* Do not check inactive or non-SDP registered sockets */
- continue;
- }
- if(pCurrentSocket->sServiceName.length != psServiceName->length) {
- /* Service name do not match, check next */
- continue;
- }
- if(memcmp(pCurrentSocket->sServiceName.buffer, psServiceName->buffer, psServiceName->length) == 0)
- {
- /* Service name already in use */
- return NFCSTATUS_INVALID_PARAMETER;
- }
- }
- }
/* Store the listen callback */
pLlcpSocket->pfSocketListen_Cb = pListen_Cb;
@@ -1636,15 +1609,6 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Listen(phFriNfc_LlcpTranspor
/* Set RecvPending to TRUE */
pLlcpSocket->bSocketListenPending = TRUE;
- /* Store the listen socket SN */
- pLlcpSocket->sServiceName.length = psServiceName->length;
- pLlcpSocket->sServiceName.buffer = phOsalNfc_GetMemory(psServiceName->length);
- if (pLlcpSocket->sServiceName.buffer == NULL)
- {
- return NFCSTATUS_NOT_ENOUGH_MEMORY;
- }
- memcpy(pLlcpSocket->sServiceName.buffer, psServiceName->buffer, psServiceName->length);
-
/* Set the socket state*/
pLlcpSocket->eSocket_State = phFriNfc_LlcpTransportSocket_eSocketRegistered;