OpenOBEX
Functions
api.c File Reference

OpenOBEX API definition. More...

#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "obex_main.h"
#include "obex_client.h"
#include "obex_object.h"
#include "obex_body.h"
#include "obex_msg.h"
#include "obex_connect.h"
#include "databuffer.h"
#include "transport/irobex.h"
#include "transport/btobex.h"
#include "transport/usbobex.h"
#include "transport/inobex.h"
#include "transport/customtrans.h"
#include "transport/fdobex.h"
#include "obex_incl.h"
Include dependency graph for api.c:

Functions

obex_tOBEX_Init (int transport, obex_event_t eventcb, unsigned int flags)
 Initialize OBEX. More...
 
int OBEX_RegisterCTransport (obex_t *self, obex_ctrans_t *ctrans)
 Register a custom transport. More...
 
void OBEX_Cleanup (obex_t *self)
 Close down an OBEX instance. More...
 
void OBEX_SetUserData (obex_t *self, void *data)
 Set userdata of an OBEX handle. More...
 
void * OBEX_GetUserData (obex_t *self)
 Read the userdata from an OBEX handle. More...
 
void OBEX_SetUserCallBack (obex_t *self, obex_event_t eventcb, void *data)
 Change user callback on an OBEX handle. More...
 
int OBEX_SetTransportMTU (obex_t *self, uint16_t mtu_rx, uint16_t mtu_tx_max)
 Set MTU to be used for receive and transmit. More...
 
int OBEX_ServerRegister (obex_t *self, struct sockaddr *saddr, int addrlen)
 Start listening for incoming connections. More...
 
obex_tOBEX_ServerAccept (obex_t *server, obex_event_t eventcb, void *data)
 Accept an incoming connection. More...
 
void OBEX_SetTimeout (obex_t *self, int64_t timeout)
 Set the timeout for read/write operations if supported by the underlying transport. More...
 
int OBEX_Work (obex_t *self)
 Let the OBEX parser do some work. More...
 
enum obex_data_direction OBEX_GetDataDirection (obex_t *self)
 Determine data direction of OBEX_Work() More...
 
int OBEX_HandleInput (obex_t *self, int timeout)
 Let the OBEX parser do some work. More...
 
int OBEX_CustomDataFeed (obex_t *self, uint8_t *inputbuf, int actual)
 Feed OBEX with data when using a custom transport. More...
 
int OBEX_TransportConnect (obex_t *self, struct sockaddr *saddr, int addrlen)
 Try to connect to peer. More...
 
int OBEX_TransportDisconnect (obex_t *self)
 Disconnect transport. More...
 
int OBEX_GetFD (obex_t *self)
 Get transport file descriptor. More...
 
int OBEX_Request (obex_t *self, obex_object_t *object)
 Schedule a request (as client). More...
 
int OBEX_CancelRequest (obex_t *self, int nice)
 Cancel an ongoing operation. More...
 
int OBEX_SuspendRequest (obex_t *self, obex_object_t *object)
 Suspend transfer of an object. More...
 
int OBEX_ResumeRequest (obex_t *self)
 Resume transfer of an object. More...
 
void OBEX_SetReponseMode (obex_t *self, enum obex_rsp_mode rsp_mode)
 Set the OBEX response mode. More...
 
obex_object_tOBEX_ObjectNew (obex_t *self, uint8_t cmd)
 Create a new OBEX Object. More...
 
int OBEX_ObjectDelete (obex_t *self, obex_object_t *object)
 Delete an OBEX object. More...
 
int OBEX_ObjectGetSpace (obex_t *self, obex_object_t *object, unsigned int flags)
 Get available space in object. More...
 
int OBEX_ObjectAddHeader (obex_t *self, obex_object_t *object, uint8_t hi, obex_headerdata_t hv, uint32_t hv_size, unsigned int flags)
 Attach a header to an object. More...
 
int OBEX_ObjectGetNextHeader (obex_t *self, obex_object_t *object, uint8_t *hi, obex_headerdata_t *hv, uint32_t *hv_size)
 Get next available header from an object. More...
 
int OBEX_ObjectReParseHeaders (obex_t *self, obex_object_t *object)
 Allow the user to parse again the rx headers. More...
 
int OBEX_ObjectReadStream (obex_t *self, obex_object_t *object, const uint8_t **buf)
 Read data from body stream. More...
 
int OBEX_ObjectSetRsp (obex_object_t *object, uint8_t rsp, uint8_t lastrsp)
 Sets the response to a received request. More...
 
int OBEX_ObjectGetNonHdrData (obex_object_t *object, uint8_t **buffer)
 Get any data which was before headers. More...
 
int OBEX_ObjectSetNonHdrData (obex_object_t *object, const uint8_t *buffer, unsigned int len)
 Set data to send before headers. More...
 
int OBEX_ObjectSetHdrOffset (obex_object_t *object, unsigned int offset)
 Set headeroffset. More...
 
int OBEX_ObjectGetCommand (obex_t *self, obex_object_t *object)
 Get the OBEX commmand of an object. More...
 
char * OBEX_ResponseToString (int rsp)
 Return a human understandable string from a response-code. More...
 
int OBEX_SetCustomData (obex_t *self, void *data)
 Set customdata of an OBEX handle. More...
 
void * OBEX_GetCustomData (obex_t *self)
 Read the customdata from an OBEX handle. More...
 
int TcpOBEX_ServerRegister (obex_t *self, struct sockaddr *addr, int addrlen)
 Start listening for incoming TCP connections. More...
 
int TcpOBEX_TransportConnect (obex_t *self, struct sockaddr *addr, int addrlen)
 Connect TCP transport. More...
 
int IrOBEX_ServerRegister (obex_t *self, const char *service)
 Start listening for incoming connections. More...
 
int IrOBEX_TransportConnect (obex_t *self, const char *service)
 Connect Irda transport. More...
 
int BtOBEX_ServerRegister (obex_t *self, const bt_addr_t *src, uint8_t channel)
 Start listening for incoming connections. More...
 
int BtOBEX_TransportConnect (obex_t *self, const bt_addr_t *src, const bt_addr_t *dst, uint8_t channel)
 Connect Bluetooth transport. More...
 
int FdOBEX_TransportSetup (obex_t *self, int rfd, int wfd, int mtu)
 
int OBEX_InterfaceConnect (obex_t *self, obex_interface_t *intf)
 Connect USB interface. More...
 
int OBEX_EnumerateInterfaces (obex_t *self)
 Find OBEX interfaces on the system. More...
 
obex_interface_tOBEX_GetInterfaceByIndex (obex_t *self, int i)
 Get OBEX interface information. More...
 
void OBEX_FreeInterfaces (obex_t *self)
 Free memory allocated to OBEX interface structures. More...
 

Detailed Description

OpenOBEX API definition.

OpenOBEX library - Free implementation of the Object Exchange protocol.

Copyright (c) 1999, 2000 Dag Brattli, All Rights Reserved. Copyright (c) 1999, 2000 Pontus Fuchs, All Rights Reserved.

OpenOBEX is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with OpenOBEX. If not, see http://www.gnu.org/.

Function Documentation

§ BtOBEX_ServerRegister()

int BtOBEX_ServerRegister ( obex_t self,
const bt_addr_t *  src,
uint8_t  channel 
)

Start listening for incoming connections.

Parameters
selfOBEX handle
srcsource address to listen on
channelsource channel to listen on
Returns
-1 or negative error code on error

An easier server function to use for Bluetooth (Bluetooth OBEX) only.

§ BtOBEX_TransportConnect()

int BtOBEX_TransportConnect ( obex_t self,
const bt_addr_t *  src,
const bt_addr_t *  dst,
uint8_t  channel 
)

Connect Bluetooth transport.

Parameters
selfOBEX handle
srcsource address to connect from
dstdestination address to connect to
channeldestination channel to connect to
Returns
-1 or negative error code on error

An easier connect function to use for Bluetooth (Bluetooth OBEX) only.

§ FdOBEX_TransportSetup()

int FdOBEX_TransportSetup ( obex_t self,
int  rfd,
int  wfd,
int  mtu 
)

§ IrOBEX_ServerRegister()

int IrOBEX_ServerRegister ( obex_t self,
const char *  service 
)

Start listening for incoming connections.

Parameters
selfOBEX handle
serviceService to bind to.
Returns
-1 or negative error code on error

An easier server function to use for IrDA (IrOBEX) only.

§ IrOBEX_TransportConnect()

int IrOBEX_TransportConnect ( obex_t self,
const char *  service 
)

Connect Irda transport.

Parameters
selfOBEX handle
serviceIrIAS service name to connect to
Returns
-1 or negative error code on error

An easier connect function to use for IrDA (IrOBEX) only.

§ OBEX_CancelRequest()

int OBEX_CancelRequest ( obex_t self,
int  nice 
)

Cancel an ongoing operation.

Parameters
selfOBEX handle
niceIf true an OBEX Abort will be sent if beeing client or respond with an error if beeing server.
Returns
-1 on error

§ OBEX_Cleanup()

void OBEX_Cleanup ( obex_t self)

Close down an OBEX instance.

Parameters
selfOBEX handle

Disconnects the transport and frees the interface (see OBEX_FreeInterfaces).

§ OBEX_CustomDataFeed()

int OBEX_CustomDataFeed ( obex_t self,
uint8_t *  inputbuf,
int  actual 
)

Feed OBEX with data when using a custom transport.

Parameters
selfOBEX handle
inputbufPointer to custom data
actualLength of buffer
Returns
-1 on error

§ OBEX_EnumerateInterfaces()

int OBEX_EnumerateInterfaces ( obex_t self)

Find OBEX interfaces on the system.

Parameters
selfOBEX handle
Returns
the number of OBEX interfaces.

§ OBEX_FreeInterfaces()

void OBEX_FreeInterfaces ( obex_t self)

Free memory allocated to OBEX interface structures.

Parameters
selfOBEX handle

Frees memory allocated to OBEX interface structures after it has been allocated by OBEX_EnumerateInterfaces.

§ OBEX_GetCustomData()

void* OBEX_GetCustomData ( obex_t self)

Read the customdata from an OBEX handle.

Parameters
selfOBEX handle
Returns
custom transport data, NULL on error

§ OBEX_GetDataDirection()

enum obex_data_direction OBEX_GetDataDirection ( obex_t self)

Determine data direction of OBEX_Work()

Parameters
selfOBEX handle

Use this to achieve better integration of OBEX_Work() into mainloops. You should call this after each call of OBEX_Work(). If OBEX_DATA_NONE is returned, it depends on your event callback when to re-enable mainloop events.

§ OBEX_GetFD()

int OBEX_GetFD ( obex_t self)

Get transport file descriptor.

Parameters
selfOBEX handle
Returns
file descriptor of the transport, -1 on error

Returns the file descriptor of the transport or -1 on error. Note that not all transports have a file descriptor, especially USB and custom transports do not.

The returned filehandle can be used to do select() on, before calling OBEX_HandleInput()

There is one subtelty about this function. When the OBEX connection is established, it returns the connection filedescriptor, while for an unconnected server it will return the listening filedescriptor. This mean that after receiving an incomming connection, you need to call this function again.

§ OBEX_GetInterfaceByIndex()

obex_interface_t* OBEX_GetInterfaceByIndex ( obex_t self,
int  i 
)

Get OBEX interface information.

Parameters
selfOBEX handle
iinterface number
Returns
OBEX interface information.

§ OBEX_GetUserData()

void* OBEX_GetUserData ( obex_t self)

Read the userdata from an OBEX handle.

Parameters
selfOBEX handle
Returns
the userdata

Returns userdata set with OBEX_SetUserData.

§ OBEX_HandleInput()

int OBEX_HandleInput ( obex_t self,
int  timeout 
)

Let the OBEX parser do some work.

Parameters
selfOBEX handle
timeoutMaximum time to wait in seconds (-1 for infinite)
Returns
-1 on error, 0 on timeout, positive on success

Deprecated.

Let the OBEX parser read and process incoming data and send the response.

The timeout parameter is only for the reading part, preparing and sending can take any amount of time.

§ OBEX_Init()

obex_t* OBEX_Init ( int  transport,
obex_event_t  eventcb,
unsigned int  flags 
)

Initialize OBEX.

Parameters
transportWhich transport to use. The following transports are available :
eventcbFunction pointer to your event callback. See obex.h for prototype of this callback.
flagsBitmask of flags. The following flags are available :
Returns
an OBEX handle or NULL on error.

§ OBEX_InterfaceConnect()

int OBEX_InterfaceConnect ( obex_t self,
obex_interface_t intf 
)

Connect USB interface.

Parameters
selfOBEX handle
intfUSB interface to connect to
Returns
-1 or negative error code on error

An easier connect function to connect to a discovered interface (currently USB OBEX only).

§ OBEX_ObjectAddHeader()

int OBEX_ObjectAddHeader ( obex_t self,
obex_object_t object,
uint8_t  hi,
obex_headerdata_t  hv,
uint32_t  hv_size,
unsigned int  flags 
)

Attach a header to an object.

Parameters
selfOBEX handle
objectOBEX object
hiHeader identifier
hvHeader value
hv_sizeHeader size
flagsSee obex.h for possible values
Returns
-1 on error

Add a new header to an object.

If you want all headers to fit in one packet, use the flag OBEX_FL_FIT_ONE_PACKET on all headers you add to an object.

To stream a body add a body header with hv.bs = NULL and set the flag OBEX_FL_STREAM_START. You will now get OBEX_EV_STREAMEMPTY events as soon as the the parser wants you to feed it with more data.

When you get an OBEX_EV_STREAMEMPTY event give the parser some data by adding a body-header and set the flag OBEX_FL_STREAM_DATA. When you have no more data to send set the flag OBEX_FL_STREAM_DATAEND instead.

After adding a header you are free to do whatever you want with the buffer if you are NOT streaming. If you are streaming you may not touch the buffer until you get another OBEX_EV_STREAMEMPTY or until the request finishes.

The headers will be sent in the order you add them.

§ OBEX_ObjectDelete()

int OBEX_ObjectDelete ( obex_t self,
obex_object_t object 
)

Delete an OBEX object.

Parameters
selfOBEX handle
objectobject to delete.
Returns
-1 on error

Note that as soon as you have passed an object to the lib using OBEX_Request(), you shall not delete it yourself.

§ OBEX_ObjectGetCommand()

int OBEX_ObjectGetCommand ( obex_t self,
obex_object_t object 
)

Get the OBEX commmand of an object.

Parameters
selfOBEX context
objectOBEX object (or NULL to access the current object)
Returns
-1 on error

Call this function to get the OBEX command of an object.

§ OBEX_ObjectGetNextHeader()

int OBEX_ObjectGetNextHeader ( obex_t self,
obex_object_t object,
uint8_t *  hi,
obex_headerdata_t hv,
uint32_t *  hv_size 
)

Get next available header from an object.

Parameters
selfOBEX handle (ignored)
objectOBEX object
hiPointer to header identifier
hvPointer to hv
hv_sizePointer to hv_size
Returns
0 when no more headers are available, -1 on error

Returns 0 when no more headers are available.

All headers are read-only.

You will get the headers in the received order.

§ OBEX_ObjectGetNonHdrData()

int OBEX_ObjectGetNonHdrData ( obex_object_t object,
uint8_t **  buffer 
)

Get any data which was before headers.

Parameters
objectOBEX object
bufferPointer to a pointer which will point to a read-only buffer
Returns
size of the buffer or -1 for error

§ OBEX_ObjectGetSpace()

int OBEX_ObjectGetSpace ( obex_t self,
obex_object_t object,
unsigned int  flags 
)

Get available space in object.

Parameters
selfOBEX handle
objectOBEX object to query
flagsOBEX_FL_FIT_ONE_PACKET or 0
Returns
-1 on error

Returns the available space in a given obex object.

This can be useful e.g. if the caller wants to check the size of the biggest body header that can be added to the current packet.

§ OBEX_ObjectNew()

obex_object_t* OBEX_ObjectNew ( obex_t self,
uint8_t  cmd 
)

Create a new OBEX Object.

Parameters
selfOBEX handle
cmdcommand of object
Returns
pointer to a new OBEX Object, NULL on error

§ OBEX_ObjectReadStream()

int OBEX_ObjectReadStream ( obex_t self,
obex_object_t object,
const uint8_t **  buf 
)

Read data from body stream.

Parameters
selfOBEX handle
objectOBEX object (ignored)
bufA pointer to a pointer which this function will set to a buffer which shall be read (and ONLY read) after this function returns.
Returns
number of bytes in buffer, or 0 for end-of-stream, -1 on error

To recieve the body as a stream call this function with buf = NULL as soon as you get an OBEX_EV_REQHINT event.

You will now recieve OBEX_EV_STREAMAVAIL events when data is available for you. Call this function to get the data.

Note! When receiving a stream data is not buffered so if you don't call this function when you get an OBEX_EV_STREAMAVAIL event data will be lost.

§ OBEX_ObjectReParseHeaders()

int OBEX_ObjectReParseHeaders ( obex_t self,
obex_object_t object 
)

Allow the user to parse again the rx headers.

Parameters
selfOBEX handle (ignored)
objectOBEX object
Returns
1 on success, 0 if previous parsing not completed, -1 on error

Next call to OBEX_ObjectGetNextHeader() will return the first received header.

§ OBEX_ObjectSetHdrOffset()

int OBEX_ObjectSetHdrOffset ( obex_object_t object,
unsigned int  offset 
)

Set headeroffset.

Parameters
objectOBEX object
offsetDesired offset
Returns
1 on success, -1 on error

Call this function when you get a OBEX_EV_REQHINT and you know that the command has data before the headers comes. You do NOT need to use this function on Connect and SetPath, they are handled automatically.

§ OBEX_ObjectSetNonHdrData()

int OBEX_ObjectSetNonHdrData ( obex_object_t object,
const uint8_t *  buffer,
unsigned int  len 
)

Set data to send before headers.

Parameters
objectOBEX object
bufferData to send
lenLength to data
Returns
1 on success, -1 on error

Some commands (notably SetPath) send data before headers. Use this function to set this data.

§ OBEX_ObjectSetRsp()

int OBEX_ObjectSetRsp ( obex_object_t object,
uint8_t  rsp,
uint8_t  lastrsp 
)

Sets the response to a received request.

Parameters
objectOBEX object
rspRespose code in non-last packets
lastrspResponse code in last packet
Returns
-1 on error

§ OBEX_RegisterCTransport()

int OBEX_RegisterCTransport ( obex_t self,
obex_ctrans_t ctrans 
)

Register a custom transport.

Parameters
selfOBEX handle
ctransStructure with callbacks to transport operations (see obex_const.h for details)
Returns
-1 on error

Call this function directly after OBEX_Init if you are using a custom transport.

§ OBEX_Request()

int OBEX_Request ( obex_t self,
obex_object_t object 
)

Schedule a request (as client).

Parameters
selfOBEX handle
objectObject containing request
Returns
0 on success or a negative error code on failure (-EBUSY, -EINVAL, -EIO)

§ OBEX_ResponseToString()

char* OBEX_ResponseToString ( int  rsp)

Return a human understandable string from a response-code.

Parameters
rspResponse code.
Returns
static response code string

The returned string must not be freed. If the response code is unknown, the string "Unknown response" will be returned.

§ OBEX_ResumeRequest()

int OBEX_ResumeRequest ( obex_t self)

Resume transfer of an object.

Parameters
selfOBEX handle
Returns
-1 on error

§ OBEX_ServerAccept()

obex_t* OBEX_ServerAccept ( obex_t server,
obex_event_t  eventcb,
void *  data 
)

Accept an incoming connection.

Parameters
serverOBEX handle
eventcbEvent callback for client (use NULL for same as server)
dataUserdata for client (use NULL for same as server)
Returns
the client instance or NULL on error

Create a new OBEX instance to handle the incomming connection. The old OBEX instance will continue to listen for new connections. The two OBEX instances become totally independant from each other.

This function should be called after the library generates an OBEX_EV_ACCEPTHINT event to the user, but before the user start to pull data out of the incomming connection.

Using this function also requires that the OBEX handle was created with the OBEX_FL_KEEPSERVER flag set while calling OBEX_Init().

§ OBEX_ServerRegister()

int OBEX_ServerRegister ( obex_t self,
struct sockaddr *  saddr,
int  addrlen 
)

Start listening for incoming connections.

Parameters
selfOBEX handle
saddrLocal address to bind to or NULL
addrlenLength of address
Returns
-1 on error

Bind a server socket to an Obex service. Common transport have specialised version of this function. If you want to call the listen callback of the custom transport, use NULL for saddr and 0 for addrlen.

§ OBEX_SetCustomData()

int OBEX_SetCustomData ( obex_t self,
void *  data 
)

Set customdata of an OBEX handle.

Parameters
selfOBEX handle
dataCustom Transport data
Returns
0 on success, -1 on error

Note : this call is *reserved* to the Custom Transport and should not be use by the user/client. It allow to update the Custom Transport data originally set via OBEX_RegisterCTransport(). The Custom Transport data (or instance handle) is used to store data relative to the specific instance (i.e. connection), such as file descriptors, offsets and others, so that the Custom Transport can manage multiple connections transparently (i.e. without a lookup table).

  • Jean II

§ OBEX_SetReponseMode()

void OBEX_SetReponseMode ( obex_t self,
enum obex_rsp_mode  rsp_mode 
)

Set the OBEX response mode.

Parameters
selfOBEX context
rsp_modesee OBEX_RSP_MODE_*

If you want any mode other than default (OBEX_RSP_MODE_NORMAL), you have to call this function. If you want it to affect the current object, you need to call it at the first OBEX_EV_PROGRESS (as client) or at the OBEX_EV_REQHINT or OBEX_EV_REQCHECK events (as server).

§ OBEX_SetTimeout()

void OBEX_SetTimeout ( obex_t self,
int64_t  timeout 
)

Set the timeout for read/write operations if supported by the underlying transport.

Parameters
selfOBEX handle
timeoutMaximum time to wait in milliseconds (-1 for infinite)

§ OBEX_SetTransportMTU()

int OBEX_SetTransportMTU ( obex_t self,
uint16_t  mtu_rx,
uint16_t  mtu_tx_max 
)

Set MTU to be used for receive and transmit.

Parameters
selfOBEX handle
mtu_rxmaximum receive transport packet size
mtu_tx_maxmaximum transmit transport packet size negociated
Returns
-1 or negative error code on error

Changing those values can increase the performance of the underlying transport, but will increase memory consumption and latency (especially abort latency), and may trigger bugs in buggy transport. This need to be set *before* establishing the connection.

§ OBEX_SetUserCallBack()

void OBEX_SetUserCallBack ( obex_t self,
obex_event_t  eventcb,
void *  data 
)

Change user callback on an OBEX handle.

Parameters
selfOBEX handle
eventcbFunction pointer to your new event callback.
dataPointer to the new user data to pass to the new callback (optional)

§ OBEX_SetUserData()

void OBEX_SetUserData ( obex_t self,
void *  data 
)

Set userdata of an OBEX handle.

Parameters
selfOBEX handle
dataIt's all up to you!

§ OBEX_SuspendRequest()

int OBEX_SuspendRequest ( obex_t self,
obex_object_t object 
)

Suspend transfer of an object.

Parameters
selfOBEX handle
objectobject to suspend (NULL to suspend currently transfered object)
Returns
-1 on error

§ OBEX_TransportConnect()

int OBEX_TransportConnect ( obex_t self,
struct sockaddr *  saddr,
int  addrlen 
)

Try to connect to peer.

Parameters
selfOBEX handle
saddrAddress to connect to
addrlenLength of address
Returns
-1 on error

§ OBEX_TransportDisconnect()

int OBEX_TransportDisconnect ( obex_t self)

Disconnect transport.

Parameters
selfOBEX handle
Returns
-1 on error

§ OBEX_Work()

int OBEX_Work ( obex_t self)

Let the OBEX parser do some work.

Parameters
selfOBEX handle
Returns
-1 on error, 0 on timeout, positive on success

Let the OBEX parser read and process incoming data, or prepare and send outgoing data.

When a request has been sent (client) or you are waiting for an incoming request (server) you should call this function until the request has finished.

§ TcpOBEX_ServerRegister()

int TcpOBEX_ServerRegister ( obex_t self,
struct sockaddr *  addr,
int  addrlen 
)

Start listening for incoming TCP connections.

Parameters
selfOBEX handle
addrAddress to bind to (*:650 if NULL)
addrlenLength of address structure
Returns
-1 on error

An easier server function to use for TCP/IP (TcpOBEX) only. It supports IPv4 (AF_INET) and IPv6 (AF_INET6). Note: INADDR_ANY will get mapped to IN6ADDR_ANY and using port 0 will select the default OBEX port.

§ TcpOBEX_TransportConnect()

int TcpOBEX_TransportConnect ( obex_t self,
struct sockaddr *  addr,
int  addrlen 
)

Connect TCP transport.

Parameters
selfOBEX handle
addrAddress to connect to ([::1]:650 if NULL)
addrlenLength of address structure
Returns
-1 on error

An easier connect function to use for TCP/IP (TcpOBEX) only. It supports IPv4 (AF_INET) and IPv6 (AF_INET6).