Nami | 28 Jun 2011 09:47
Favicon

[PATCH v3 openobex 1/3] Add transport format member in fdobex_data struct. Support STREAM and SEQPACKET transport format.

These patches enable fd obex transport to support SEQPACKET format to read entire packet at a time.
Add fmt member to indicate transport format, the init value is STREAM format.
Create a new api for upper layer to set transport format when using OBEX over L2CAP.

---
 include/openobex/obex_const.h |    5 +++++
 lib/fdobex.c                  |    1 +
 lib/fdobex.h                  |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/openobex/obex_const.h b/include/openobex/obex_const.h
index cb7afeb..700bacb 100644
--- a/include/openobex/obex_const.h
+++ b/include/openobex/obex_const.h
 <at>  <at>  -302,6 +302,11  <at>  <at>  enum obex_rsp_mode {
   OBEX_RSP_MODE_SINGLE = 1, /**≤ single response mode (SRM) */
 };

+enum fdobex_transport_format {
+  FDOBEX_MT_STREAM    = 0, /**≤ stream transport format */
+  FDOBEX_MT_SEQPACKET = 1, /**≤ seqpacket transport format */
+};
+
 /* Min, Max and default transport MTU */
 #define OBEX_DEFAULT_MTU	1024
 #define OBEX_MINIMUM_MTU	255
diff --git a/lib/fdobex.c b/lib/fdobex.c
index 45c56ff..7fa4a21 100644
--- a/lib/fdobex.c
+++ b/lib/fdobex.c
(Continue reading)

Nami | 28 Jun 2011 09:47
Favicon

[PATCH v3 openobex 2/3] Create new API to set fd obex transport format.

---
 include/openobex/obex.h |    1 +
 lib/obex.c              |   16 ++++++++++++++++
 lib/obex.sym            |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/openobex/obex.h b/include/openobex/obex.h
index f948113..cb1d66a 100644
--- a/include/openobex/obex.h
+++ b/include/openobex/obex.h
 <at>  <at>  -148,6 +148,7  <at>  <at>  OPENOBEX_SYMBOL(int) BtOBEX_TransportConnect(obex_t *self, bt_addr_t *src, bt_ad
  * OBEX File API
  */
 OPENOBEX_SYMBOL(int) FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu);
+OPENOBEX_SYMBOL(void)FdOBEX_SetTransportFormat(obex_t *self, enum fdobex_transport_format fmt);

 /*
  * OBEX interface discovery API
diff --git a/lib/obex.c b/lib/obex.c
index 165fcb8..8679648 100644
--- a/lib/obex.c
+++ b/lib/obex.c
 <at>  <at>  -1136,6 +1136,22  <at>  <at>  int CALLAPI FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu)
 }

 /**
+	FdOBEX_SetTransportFormat - set transport format for OBEX_TRANS_FD transport.
+
+	\param self OBEX handle
+	\param fmt transport format: FDOBEX_MT_STREAM - default
(Continue reading)

Nami | 28 Jun 2011 09:47
Favicon

[PATCH v3 openobex 3/3] Modify code to read entire packet when fd transport format is SEQPACKET.

---
 lib/fdobex.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/fdobex.c b/lib/fdobex.c
index 7fa4a21..1c97e08 100644
--- a/lib/fdobex.c
+++ b/lib/fdobex.c
 <at>  <at>  -79,6 +79,11  <at>  <at>  static int fdobex_read(obex_t *self, void *buf, int buflen)
 {
 	struct obex_transport *trans = &self->trans;

+	if(trans->data.fd.fmt == FDOBEX_MT_SEQPACKET){
+		/* set buflen large enough to read entire packet */
+		buflen = self->mtu_rx;
+	}
+
 #ifdef _WIN32
 	return  _read(trans->fd, buf, buflen);
 #else
--
1.7.1

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
(Continue reading)

Hendrik Sattler | 28 Jun 2011 10:34
Picon

Re: [PATCH v3 openobex 1/3] Add transport format member in fdobex_data struct. Support STREAM and SEQPACKET transport format.

Zitat von Nami <nami.li <at> atheros.com>:

> These patches enable fd obex transport to support SEQPACKET format  
> to read entire packet at a time.
> Add fmt member to indicate transport format, the init value is STREAM format.
> Create a new api for upper layer to set transport format when using  
> OBEX over L2CAP.

All 3 patches look ok to me. So even if it is not needed for L2CAP on  
bluez, it is a useful addition for FdOBEX.

 <at> Johan: please submit them to the openobex tree.

HS

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2

Gmane