beautypg.com

Philips Bluetooth QuickStart Kit User Manual

Page 38

background image

Bluetooth QuickStart Kit Version 1.0 - User’s Guide

Page 38

Copyright 2004-2005 © Embedded Artists AB

B.2 TCP/IP

API

B.2.1 m_buf_get_data

The macro

m_buf_get_data

is defined as:

#define m_buf_get_data( pBuf ) func( pBuf )

Where

func

is a function with the following prototype:

void* func( tBuf* pBuf )

This is a macro that retrieves a pointer to the data within the buffer. What actually
happens is that the pData pointer in the buffer structure is returned.

Parameters:

[in] pBuf - buffer that contains received data.

Returns:

A pointer to the actual data that resides within the buffer.

B.2.2 tcpNewTcb

tTcpTcb* tcpNewTcb( void )

This function allocates a new control block. Returns NULL if there are no more control
blocks available.

Returns:

An allocated TCB or NULL if none available.

B.2.3 tcpBind

tS8 tcpBind( tTcpTcb* pTcb, tIPAddr* pIPAddr, tU16 port )

Bind a TCB to a port. E.g. port 80 if the application is a web server.

Parameters:

[in] pTcb - an allocated TCB that will be bound to a specific port.

[in] pIPAddr – the IP address to bind to. This parameter may be set to NULL if the
TCB should be bound to all interfaces.

[in] port - the port number to use or 0 (zero) if the stack should choose a port
number.

Returns:

One of the error codes specified below.

Possible error situations (what can be identified in an error code):

TCP_OK - no errors

TCP_NULL_POINTER - parameter pTcb was NULL.

TCP_PORT_IN_USE - port number is already assigned to a connection.