openobex:mainline.git
4 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:38:21 +0000 (11:38 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning:
 "namebuf" = storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_true: Condition "buf == NULL",
 taking true branch
apps/obex_test/obex_test_server.c:130: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.

apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning: "namebuf" =
 storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_false: Condition "buf == NULL",
 taking false branch
apps/obex_test/obex_test_server.c:133: if_end: End of if statement
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.

4 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:38:15 +0000 (11:38 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/lib/obex_put_common.c:59: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/lib/obex_put_common.c:60: switch: Switch case value "1"
apps/lib/obex_put_common.c:65: switch_case: Reached case "1"
apps/lib/obex_put_common.c:66: alloc_fn: Storage is returned from allocation
 function "malloc(size_t)".
apps/lib/obex_put_common.c:66: var_assign: Assigning: "namebuf" = storage
 returned from "malloc(hlen / 2U)".
apps/lib/obex_put_common.c:66: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/lib/obex_put_common.c:67: noescape: Resource "(uint8_t *)namebuf" is not
 freed or pointed-to in function
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)"
lib/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
  its pointer parameter "c".
apps/lib/obex_put_common.c:68: var_assign: Assigning: "name" = "namebuf".
apps/lib/obex_put_common.c:70: break: Breaking from switch
apps/lib/obex_put_common.c:82: switch_end: Reached end of switch
apps/lib/obex_put_common.c:83: loop: Jumping back to the beginning of the loop
apps/lib/obex_put_common.c:59: loop_begin: Jumped back to beginning of loop
apps/lib/obex_put_common.c:59: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
  branch
apps/lib/obex_put_common.c:83: loop_end: Reached end of loop
apps/lib/obex_put_common.c:84: cond_true: Condition "!body", taking true branch
apps/lib/obex_put_common.c:86: leaked_storage: Variable "namebuf" going out of
 scope leaks the storage it points to.
apps/lib/obex_put_common.c:86: leaked_storage: Variable "name" going out of
 scope leaks the storage it points to.

4 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:37:49 +0000 (11:37 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/ircp/ircp_client.c:281: cond_false: Condition "!(cli != NULL)", taking
 false branch
apps/ircp/ircp_client.c:281: if_end: End of if statement
apps/ircp/ircp_client.c:283: alloc_fn: Storage is returned from allocation
 function "build_object_from_file(obex_t *, char const *, char const *)".
apps/ircp/ircp_io.c:72:2: alloc_fn: Storage is returned from allocation
 function "OBEX_ObjectNew(obex_t *, uint8_t)".
apps/lib/obex.c:626:2: cond_false: Condition "!(self != NULL)", taking false
 branch
apps/lib/obex.c:626:2: if_end: End of if statement
apps/lib/obex.c:628:2: alloc_fn: Storage is returned from allocation function
 "obex_object_new(void)".
apps/lib/obex_object.c:46:2: alloc_fn: Storage is returned from allocation
 function "malloc(size_t)".
apps/lib/obex_object.c:46:2: var_assign: Assigning: "object" = "malloc(120UL)".
apps/lib/obex_object.c:47:2: cond_false: Condition "object == NULL", taking
 false branch
apps/lib/obex_object.c:48:3: if_end: End of if statement
apps/lib/obex_object.c:50:2: noescape: Resource "object" is not freed or
 pointed-to in function "memset(void *, int, size_t)".
apps/lib/obex_object.c:52:2: noescape: Resource "object" is not freed or
 pointed-to in function "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:128:39: noescape:
 "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex_object.c:54:2: return_alloc: Returning allocated memory "object".
apps/lib/obex.c:628:2: var_assign: Assigning: "object" = "obex_object_new()".
apps/lib/obex.c:629:2: cond_false: Condition "object == NULL", taking false
 branch
apps/lib/obex.c:630:3: if_end: End of if statement
apps/lib/obex.c:632:2: noescape: Resource "object" is not freed or pointed-to
 in function "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:113:39: noescape:
 "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex.c:634:2: cond_true: Condition "cmd == 0", taking true branch
apps/lib/obex.c:635:3: noescape: Resource "object" is not freed or pointed-to
 in function "obex_insert_connectframe(obex_t *, obex_object_t *)".
apps/lib/obex_connect.c:42:59: noescape:
"obex_insert_connectframe(obex_t *, obex_object_t *)" does not free or save its
 pointer parameter "object".
apps/lib/obex.c:635:3: cond_false: Condition
 "obex_insert_connectframe(self, object) < 0", taking false branch
apps/lib/obex.c:638:3: if_end: End of if statement
apps/lib/obex.c:641:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_io.c:72:2: var_assign: Assigning:
 "object" = "OBEX_ObjectNew(handle, 2)".
apps/ircp/ircp_io.c:73:2: cond_false: Condition "object == NULL", taking false
 branch
apps/ircp/ircp_io.c:74:3: if_end: End of if statement
apps/ircp/ircp_io.c:78:2: cond_false: Condition "ucname == NULL", taking false
 branch
apps/ircp/ircp_io.c:79:3: if_end: End of if statement
apps/ircp/ircp_io.c:84:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:88:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:98:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:102:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_client.c:283: var_assign: Assigning: "object" = storage returned
 from "build_object_from_file(cli->obexhandle, localname, remotename)".
apps/ircp/ircp_client.c:286: cond_true: Condition "cli->fd < 0", taking true
 branch
apps/ircp/ircp_client.c:287: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:289: if_end: End of if statement
apps/ircp/ircp_client.c:293: cond_true: Condition "ret < 0", taking true branch
apps/ircp/ircp_client.c:294: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:296: if_end: End of if statement
apps/ircp/ircp_client.c:298: leaked_storage: Variable "object" going out of
 scope leaks the storage it points to.

4 years agoFix: NEGATIVE_RETURNS (CWE-394)
Tomas Hozza [Sun, 24 Feb 2013 09:38:50 +0000 (10:38 +0100)]
Fix: NEGATIVE_RETURNS (CWE-394)

Coverity output:
apps/ircp/ircp_client.c:281: cond_false: Condition "!(cli != NULL)", taking
false branch
apps/ircp/ircp_client.c:281: if_end: End of if statement
apps/ircp/ircp_client.c:285: negative_return_fn: Function
"open(localname, 0, 0)" returns a negative number.
apps/ircp/ircp_client.c:285: var_assign: Assigning: signed variable
"cli->fd" = "open(char const *, int, ...)".
apps/ircp/ircp_client.c:286: cond_true: Condition "cli->fd < 0", taking true
branch
apps/ircp/ircp_client.c:287: if_fallthrough: Falling through to end of if
statement
apps/ircp/ircp_client.c:289: if_end: End of if statement
apps/ircp/ircp_client.c:291: negative_returns: "cli->fd" is passed to a
parameter that cannot be negative.

4 years agoFix: CHECKED_RETURN (CWE-252)
Tomas Hozza [Sun, 24 Feb 2013 09:38:46 +0000 (10:38 +0100)]
Fix: CHECKED_RETURN (CWE-252)

Coverity output:
apps/ircp/ircp_io.c:49: check_return: Calling function "stat(name, &stats)"
without checking return value. This library function may fail and return an
error code.
apps/ircp/ircp_io.c:49: unchecked_value: No check of the return value of
"stat(name, &stats)".

4 years agoFix: CHECKED_RETURN (CWE-252)
Tomas Hozza [Sun, 24 Feb 2013 09:38:39 +0000 (10:38 +0100)]
Fix: CHECKED_RETURN (CWE-252)

Coverity output:
apps/lib/obex_io.c:68: check_return: Calling function
"stat(filename, &stats)" without checking return value. This library
function may fail and return an error code.
apps/obex_io.c:68: unchecked_value: No check of
the return value of "stat(filename, &stats)".

4 years agoAdd new header file openobex/version.h
Hendrik Sattler [Sat, 23 Feb 2013 11:19:07 +0000 (12:19 +0100)]
Add new header file openobex/version.h

4 years agoRemove left-over automake file
Hendrik Sattler [Sat, 23 Feb 2013 10:32:50 +0000 (11:32 +0100)]
Remove left-over automake file

4 years agoFix: limit each packet to at most one BODY/BODY_END header
Hendrik Sattler [Fri, 22 Feb 2013 12:41:03 +0000 (13:41 +0100)]
Fix: limit each packet to at most one BODY/BODY_END header

The Android OBEX implementation is buggy, so that a transfer always fails
because our last packet used to contain on BODY header and an (empty) BODY_END
header. Now, the BODY_END header is forced to an additional packet.

4 years agoFix update of cmake file install location on version change
Hendrik Sattler [Thu, 21 Feb 2013 21:33:28 +0000 (22:33 +0100)]
Fix update of cmake file install location on version change

4 years agoFix return codes for OBEX_Request()
Hendrik Sattler [Tue, 19 Feb 2013 08:51:10 +0000 (09:51 +0100)]
Fix return codes for OBEX_Request()

Also, since TX_REQUEST substate is set here, call the client state machine.

4 years agoDynamically create header file for symbol export definitions
Hendrik Sattler [Sun, 17 Feb 2013 22:43:14 +0000 (23:43 +0100)]
Dynamically create header file for symbol export definitions

4 years agoFix: remove markdown usage; OBEX_HandleInput -> OBEX_Work
Hendrik Sattler [Sun, 10 Feb 2013 16:25:37 +0000 (17:25 +0100)]
Fix: remove markdown usage; OBEX_HandleInput -> OBEX_Work

4 years agoStrip default settings
Hendrik Sattler [Sun, 10 Feb 2013 16:24:20 +0000 (17:24 +0100)]
Strip default settings

4 years agoAdd function to determine current data direction for OBEX_Work()
Hendrik Sattler [Sun, 10 Feb 2013 12:16:53 +0000 (13:16 +0100)]
Add function to determine current data direction for OBEX_Work()

4 years agoRestore older behaviour of OBEX_HandleInput() and add OBEX_Work() and OBEX_SetTimeout()
Hendrik Sattler [Sun, 10 Feb 2013 12:10:37 +0000 (13:10 +0100)]
Restore older behaviour of OBEX_HandleInput() and add OBEX_Work() and OBEX_SetTimeout()

In earlier versions like OpenObex-1.3, OBEX_HandleInput() really only needed to
be called when there was input available. The new behaviour also needed a call
to send data. Thus it was possible to make application non-functional that
depend on this behaviour (e.g. calling OBEX_HandleInput() from glib mainloop).

As a drawback, the timeout behaviour only means how to wait for input.
Preparing (application callbacks) or sending data can take any amount of time.

4 years agoAlways call the tx prepare function when setting SUBSTATE_TX_PREPARE
Hendrik Sattler [Sun, 10 Feb 2013 12:03:25 +0000 (13:03 +0100)]
Always call the tx prepare function when setting SUBSTATE_TX_PREPARE

4 years agoUse milliseconds in an int64_t for timeout value internally
Hendrik Sattler [Sun, 10 Feb 2013 12:01:58 +0000 (13:01 +0100)]
Use milliseconds in an int64_t for timeout value internally

4 years agoFix memory leaks
Hendrik Sattler [Wed, 3 Oct 2012 16:04:29 +0000 (18:04 +0200)]
Fix memory leaks

4 years agoForce correctness of integer headers when sending
Hendrik Sattler [Wed, 3 Oct 2012 06:21:05 +0000 (08:21 +0200)]
Force correctness of integer headers when sending

4 years agoAdd set_data() member for all obex_hdr
Hendrik Sattler [Wed, 3 Oct 2012 05:15:01 +0000 (07:15 +0200)]
Add set_data() member for all obex_hdr

This also share code of the pointer header in the stream header.

5 years agoFix file transfer server->client with more than one packet
Hendrik Sattler [Sun, 2 Sep 2012 06:09:21 +0000 (08:09 +0200)]
Fix file transfer server->client with more than one packet

5 years agoFix receiving files as server
Hendrik Sattler [Tue, 7 Aug 2012 20:09:58 +0000 (22:09 +0200)]
Fix receiving files as server

5 years agoAvoid double-free of body header
Hendrik Sattler [Wed, 1 Aug 2012 03:47:24 +0000 (05:47 +0200)]
Avoid double-free of body header

The body struct obex_hdr might still be present in the rx or tx header queues
at object deletion time. Avoid calling free() two times on that memory.

5 years agoSend 4-byte headers in network byte order
Hendrik Sattler [Tue, 31 Jul 2012 21:04:36 +0000 (23:04 +0200)]
Send 4-byte headers in network byte order

5 years agoReturn BODY_END on last header part
Hendrik Sattler [Tue, 31 Jul 2012 19:58:25 +0000 (21:58 +0200)]
Return BODY_END on last header part

5 years agoUse bool instead of int
Hendrik Sattler [Tue, 31 Jul 2012 19:55:01 +0000 (21:55 +0200)]
Use bool instead of int

5 years agoFix: do not delete object
Hendrik Sattler [Sat, 28 Jul 2012 19:10:00 +0000 (21:10 +0200)]
Fix: do not delete object

5 years agoinclude <string.h> for memcpy()
Iain Hibbert [Mon, 23 Jul 2012 18:30:15 +0000 (19:30 +0100)]
include <string.h> for memcpy()

5 years agoFix wrong logic for TX I/O
Hendrik Sattler [Mon, 9 Jul 2012 19:59:32 +0000 (21:59 +0200)]
Fix wrong logic for TX I/O

5 years agoMerge substates TX_INPROGRESS and TX_COMPLETE
Hendrik Sattler [Fri, 6 Jul 2012 19:46:19 +0000 (21:46 +0200)]
Merge substates TX_INPROGRESS and TX_COMPLETE

5 years agoChange return type of obex_msg_rx_status() to bool
Hendrik Sattler [Thu, 5 Jul 2012 17:47:08 +0000 (19:47 +0200)]
Change return type of obex_msg_rx_status() to bool

5 years agoMove buffer check to obex_msg
Hendrik Sattler [Wed, 4 Jul 2012 20:15:28 +0000 (22:15 +0200)]
Move buffer check to obex_msg

5 years agoMove SRM zero check to obex_main
Hendrik Sattler [Wed, 4 Jul 2012 04:05:28 +0000 (06:05 +0200)]
Move SRM zero check to obex_main

5 years agoDon't send fatal errors with blocking behaviour
Hendrik Sattler [Thu, 28 Jun 2012 04:57:24 +0000 (06:57 +0200)]
Don't send fatal errors with blocking behaviour

Instead, these errors are sent asynchronously from obex_work(), now.
Two "Internal Server Error"s are not sent anymore, this was wrong anyway.

5 years agoMake last argument of obex_deliver_event bool
Hendrik Sattler [Thu, 28 Jun 2012 04:54:44 +0000 (06:54 +0200)]
Make last argument of obex_deliver_event bool

5 years agoDeclare boolean arguments as bool
Hendrik Sattler [Mon, 25 Jun 2012 20:37:58 +0000 (22:37 +0200)]
Declare boolean arguments as bool

5 years agoChange substates and move common transmit code to obex_main
Hendrik Sattler [Sun, 24 Jun 2012 07:50:20 +0000 (09:50 +0200)]
Change substates and move common transmit code to obex_main

5 years agoShare code for setting MTU
Hendrik Sattler [Wed, 20 Jun 2012 19:29:45 +0000 (21:29 +0200)]
Share code for setting MTU

5 years agoRename lib/obex.c to lib/api.c
Hendrik Sattler [Wed, 20 Jun 2012 19:03:13 +0000 (21:03 +0200)]
Rename lib/obex.c to lib/api.c

5 years agoMove some function implementations to obex_main.c
Hendrik Sattler [Wed, 20 Jun 2012 18:58:08 +0000 (20:58 +0200)]
Move some function implementations to obex_main.c

This moves the function body of OBEX_Init to obex_library_init and obex_create
and makes the result reusable by OBEX_ServerAccept. Two other function bodys are
also moved.

5 years agoAdd missing $
Iain Hibbert [Tue, 19 Jun 2012 18:34:45 +0000 (19:34 +0100)]
Add missing $

5 years agoExtend cmake installed config file
Hendrik Sattler [Sat, 16 Jun 2012 06:37:01 +0000 (08:37 +0200)]
Extend cmake installed config file

Additionally, the same file can be used to directly use the files from a
build tree.

5 years agoMove server/connected decision back to obex_main
Hendrik Sattler [Thu, 14 Jun 2012 20:33:49 +0000 (22:33 +0200)]
Move server/connected decision back to obex_main

This needs a new transport attribute 'is_server' that indicates if listen was
called on this obex_t or if this obex_t is one that to be connected/accepted.
This needs a new create operation in obex_transport_ops and allows to simplify
obex_transport_create().

5 years agoRemove mtu attribute from obex_transport
Hendrik Sattler [Sun, 10 Jun 2012 19:20:03 +0000 (21:20 +0200)]
Remove mtu attribute from obex_transport

This was actively only used in fdobex but even there, it is not needed and is
handled more easily by choosing non-blocking behaviour.

5 years agoRemove type member from obex_transport
Hendrik Sattler [Sun, 10 Jun 2012 16:41:15 +0000 (18:41 +0200)]
Remove type member from obex_transport

According to IrOBEX specification, there is no IrTTP alignment requirement and
thus we just don't do this.
The only remaining usage of the type member is for protecting custom transport
data member access. This is not strictly needed, so it is also removed.

5 years agoRestrict transport calls to the value of connected attribute
Hendrik Sattler [Sun, 10 Jun 2012 11:12:08 +0000 (13:12 +0200)]
Restrict transport calls to the value of connected attribute

5 years agoRemove unnecessary includes and prototypes
Hendrik Sattler [Sun, 10 Jun 2012 11:09:09 +0000 (13:09 +0200)]
Remove unnecessary includes and prototypes

5 years agoChange transport functions return types
Hendrik Sattler [Sun, 10 Jun 2012 10:52:04 +0000 (12:52 +0200)]
Change transport functions return types

This inlcudes the return types of the obex_transport_* functions and
the function pointers in obex_transport_ops. The "connected" member is changed
to bool and the result of connect, accept and disconnect is assigned to it.

5 years agoFix socket disconnect
Hendrik Sattler [Sun, 10 Jun 2012 07:44:11 +0000 (09:44 +0200)]
Fix socket disconnect

5 years agoAdd CMake export files
Hendrik Sattler [Thu, 7 Jun 2012 20:47:20 +0000 (22:47 +0200)]
Add CMake export files

5 years agoFix independent transport data allocation
Hendrik Sattler [Thu, 7 Jun 2012 20:38:05 +0000 (22:38 +0200)]
Fix independent transport data allocation

5 years agoReplace int by fd_t for file descriptors
Hendrik Sattler [Tue, 5 Jun 2012 18:56:24 +0000 (20:56 +0200)]
Replace int by fd_t for file descriptors

File descriptors are unsigned int on WIN32 and int everywhere else.

5 years agoConvert int return values to bool or result_t
Hendrik Sattler [Tue, 5 Jun 2012 18:50:48 +0000 (20:50 +0200)]
Convert int return values to bool or result_t

5 years agoUnify socket transports
Hendrik Sattler [Sun, 3 Jun 2012 19:11:06 +0000 (21:11 +0200)]
Unify socket transports

This unifies the socket implementations for bluetooth, IrDA and TCP.

5 years agoUse defines.h for standard types
Hendrik Sattler [Sun, 3 Jun 2012 10:29:37 +0000 (12:29 +0200)]
Use defines.h for standard types

The include inttypes.h is moved to defines.h. The C99 include stdbool.h is also
added to allow usage of 'bool' type. An additional return_t type is added.

5 years agoAllocate each transport data independently
Hendrik Sattler [Sun, 13 May 2012 09:12:11 +0000 (11:12 +0200)]
Allocate each transport data independently

5 years agoRename states SEND and REC
Hendrik Sattler [Sat, 12 May 2012 20:56:08 +0000 (22:56 +0200)]
Rename states SEND and REC

5 years agoFix buffered body reception
Hendrik Sattler [Sat, 12 May 2012 11:09:51 +0000 (13:09 +0200)]
Fix buffered body reception

5 years agoFix return codes
Hendrik Sattler [Sat, 12 May 2012 11:03:18 +0000 (13:03 +0200)]
Fix return codes

5 years agoFix memory leaks
Hendrik Sattler [Fri, 11 May 2012 20:24:30 +0000 (22:24 +0200)]
Fix memory leaks

5 years agoAdd missing calls to cleanup RX buffer
Hendrik Sattler [Fri, 11 May 2012 04:37:53 +0000 (06:37 +0200)]
Add missing calls to cleanup RX buffer

5 years agoFix server events and object management
Hendrik Sattler [Thu, 10 May 2012 19:50:37 +0000 (21:50 +0200)]
Fix server events and object management

5 years agoRemove autotools build files
Hendrik Sattler [Sat, 5 May 2012 12:58:28 +0000 (14:58 +0200)]
Remove autotools build files

Cmake is way more flexible and we don't need to maintain two build systems.
If anyone insists on autotools (for whatever strange reason), please note
that reverting this change is not sufficient.

5 years agoRework msg creation/reception
Hendrik Sattler [Sat, 5 May 2012 12:35:50 +0000 (14:35 +0200)]
Rework msg creation/reception

Everything needed to control creation of a TX message from an obex_object_t and
to control parsing a RX message to an obex_object_t is now in obex_msg.c.
Almost all functions in obex_object.c are now independent of obex_t.

5 years agoSplit-off TX header post-processing
Hendrik Sattler [Mon, 30 Apr 2012 14:28:50 +0000 (16:28 +0200)]
Split-off TX header post-processing

Some headers (e.g. the SRM flags header) must be evaluated after being being
put into a TX message buffer. To get this out of the object append function,
the TX headers do not get deleted after usage and a header iterator is used
instead.

5 years agoSimplify obex_hdr iterator
Hendrik Sattler [Mon, 30 Apr 2012 08:48:00 +0000 (10:48 +0200)]
Simplify obex_hdr iterator

A pointer to a list element is sufficient, it does not need to be a deep copy.
To make it easier to us a [a..b] range or reuse the current element, the
function obex_hdr_it_getnext() is split and a comparison function is added.

5 years agoRemove obex_t argument from obex_object_finished()
Hendrik Sattler [Sat, 28 Apr 2012 07:19:51 +0000 (09:19 +0200)]
Remove obex_t argument from obex_object_finished()

5 years agoRemove obex_t argument from obex_object_reparseheaders()
Hendrik Sattler [Sat, 28 Apr 2012 07:15:27 +0000 (09:15 +0200)]
Remove obex_t argument from obex_object_reparseheaders()

5 years agoRemove obex_t argument from obex_object_getnextheader()
Hendrik Sattler [Sat, 28 Apr 2012 07:13:18 +0000 (09:13 +0200)]
Remove obex_t argument from obex_object_getnextheader()

5 years agoSplit obex_object_getspace()
Hendrik Sattler [Sat, 28 Apr 2012 07:04:34 +0000 (09:04 +0200)]
Split obex_object_getspace()

The first part is obex_object_get_size() that calculates the remaining size
of an obex_object_t and the second part is obex_msg_getspace() puts the object
in relation to the TX message buffer size. The API functionatility is kept
for compatibility.

5 years agoMove body receiving functions
Hendrik Sattler [Sun, 22 Apr 2012 10:50:15 +0000 (12:50 +0200)]
Move body receiving functions

Both functions for handling body reception are now accessible in a common way.
This makes it easier to add additional body reception functions, later.

5 years agoUse stricter typing for cmd and rsp
Hendrik Sattler [Fri, 20 Apr 2012 19:00:39 +0000 (21:00 +0200)]
Use stricter typing for cmd and rsp

5 years agoRename obex_objext_send_transmit() to obex_msg_transmit()
Hendrik Sattler [Thu, 19 Apr 2012 20:09:46 +0000 (22:09 +0200)]
Rename obex_objext_send_transmit() to obex_msg_transmit()

The function had nothing to do with obex_object_t.

5 years agoReverse calling order of object-to-buffer functionality
Hendrik Sattler [Thu, 19 Apr 2012 18:22:52 +0000 (20:22 +0200)]
Reverse calling order of object-to-buffer functionality

5 years agoUse stricter types for event wrapper
Hendrik Sattler [Wed, 18 Apr 2012 14:06:27 +0000 (16:06 +0200)]
Use stricter types for event wrapper

5 years agoPut all basic socket functions into one file
Hendrik Sattler [Sun, 15 Apr 2012 08:40:38 +0000 (10:40 +0200)]
Put all basic socket functions into one file

This also renames some functions and moves bluetooth-specific stuff back to its
own transport implementation.

5 years agoRemove old databuffer functions
Hendrik Sattler [Fri, 13 Apr 2012 22:08:13 +0000 (00:08 +0200)]
Remove old databuffer functions

5 years agoRemove obsolete files obex_header.[ch]
Hendrik Sattler [Wed, 11 Apr 2012 06:54:07 +0000 (08:54 +0200)]
Remove obsolete files obex_header.[ch]

5 years agoMove implementation to new struct obex_hdr
Hendrik Sattler [Wed, 11 Apr 2012 06:50:41 +0000 (08:50 +0200)]
Move implementation to new struct obex_hdr

5 years agoAdd new header implementation
Hendrik Sattler [Wed, 11 Apr 2012 06:38:09 +0000 (08:38 +0200)]
Add new header implementation

5 years agoUse enums instead of defines
Hendrik Sattler [Sat, 31 Mar 2012 20:03:35 +0000 (22:03 +0200)]
Use enums instead of defines

There are no implications (enum values and defines are handled the same in C)
but it makes it a lot more structured especially in documentation.

5 years agoAdd databuffer ops direct accessor functions
Hendrik Sattler [Fri, 16 Mar 2012 15:32:12 +0000 (16:32 +0100)]
Add databuffer ops direct accessor functions

5 years agoReimplement memory buffer
Hendrik Sattler [Thu, 15 Mar 2012 20:15:34 +0000 (21:15 +0100)]
Reimplement memory buffer

5 years agoRemove unused stuff
Hendrik Sattler [Sat, 17 Sep 2011 22:32:19 +0000 (00:32 +0200)]
Remove unused stuff

5 years agoAdd accessor functions to most important buffer members
Hendrik Sattler [Wed, 14 Sep 2011 20:12:21 +0000 (22:12 +0200)]
Add accessor functions to most important buffer members

5 years agoUse the slist_*() functions where possible
Hendrik Sattler [Wed, 14 Sep 2011 20:16:39 +0000 (22:16 +0200)]
Use the slist_*() functions where possible

5 years agoMove transport code to lib/transport subdir
Hendrik Sattler [Sat, 10 Sep 2011 08:09:09 +0000 (10:09 +0200)]
Move transport code to lib/transport subdir

5 years agoFix variable scope
Hendrik Sattler [Fri, 2 Sep 2011 17:41:39 +0000 (19:41 +0200)]
Fix variable scope

5 years agoFix function documentation
Hendrik Sattler [Sun, 17 Jul 2011 06:55:48 +0000 (08:55 +0200)]
Fix function documentation

5 years agoRemove unused function
Hendrik Sattler [Sun, 17 Jul 2011 06:54:44 +0000 (08:54 +0200)]
Remove unused function

5 years agoFix abort behaviour
Hendrik Sattler [Sun, 17 Jul 2011 06:55:12 +0000 (08:55 +0200)]
Fix abort behaviour

5 years agoMove obex_response_request() to the only file it is used in
Hendrik Sattler [Tue, 27 Mar 2012 18:11:43 +0000 (20:11 +0200)]
Move obex_response_request() to the only file it is used in

Additionally, it adds a small wrapper function for BAD_REQUEST which can be
used quite often. Still, this is the only case where an incomplete write/send
is not possible but adding more states for this seems overkill. After all its
only 3 bytes to send.
The abort cases are now using the STATE_ABORT with a small wrapper.

5 years agoAdd new option '-f' to obex_test
Hendrik Sattler [Sat, 16 Jul 2011 00:33:55 +0000 (02:33 +0200)]
Add new option '-f' to obex_test

5 years agoConvert OBEX_TRANS_* to an enum
Hendrik Sattler [Sun, 10 Jul 2011 09:36:17 +0000 (11:36 +0200)]
Convert OBEX_TRANS_* to an enum

5 years agoConvert OBEX_EV_* to an enum
Hendrik Sattler [Sun, 10 Jul 2011 09:35:05 +0000 (11:35 +0200)]
Convert OBEX_EV_* to an enum

5 years agoUse only one set of obex_mode defines
Hendrik Sattler [Sat, 9 Jul 2011 22:34:49 +0000 (00:34 +0200)]
Use only one set of obex_mode defines

This also makes the public type an enum (like it was for the internal type) but
the names for the values stay the same.

5 years agoAdd new OBEX_FL_NONBLOCK
Hendrik Sattler [Wed, 6 Jul 2011 20:24:40 +0000 (22:24 +0200)]
Add new OBEX_FL_NONBLOCK

5 years agoAdd new STATE_ABORT
Hendrik Sattler [Tue, 5 Jul 2011 19:46:37 +0000 (21:46 +0200)]
Add new STATE_ABORT

The old way of aborting objects does not work anymore, neither with SRM nor
with the new possibilities of incomplete writes, as that may break the
synchronisation between server and client.
This patch integrates the abort action right within the affected states.

5 years agoRemove now unused members from obex_object_t
Hendrik Sattler [Sat, 2 Jul 2011 19:44:01 +0000 (21:44 +0200)]
Remove now unused members from obex_object_t