---
include/openobex/obex_const.h | 4 ++++
lib/fdobex.h | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/openobex/obex_const.h b/include/openobex/obex_const.h
index cb7afeb..8acee91 100644
--- a/include/openobex/obex_const.h
+++ b/include/openobex/obex_const.h
@@ -302,6 +302,10 @@ enum obex_rsp_mode {
OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
};
+enum fdobex_transport_format{
+ FDOBEX_MT_STREAM ,
+ FDOBEX_MT_SEQPACKET
+};
/* Min, Max and default transport MTU */
#define OBEX_DEFAULT_MTU 1024
#define OBEX_MINIMUM_MTU 255
diff --git a/lib/fdobex.h b/lib/fdobex.h
index 07e33ab..6839e77 100644
--- a/lib/fdobex.h
+++ b/lib/fdobex.h
@@ -6,5 +6,6 @@ void fdobex_get_ops(struct obex_transport_ops* ops);
struct fdobex_data {
socket_t writefd; /* write descriptor */
+ enum fdobex_transport_format fmt;
};
#endif
--
1.7.1
SGksIA0KIEkgdGhpbmsgaXRgcyBhIGdvb2QgaWRlYSB0byBjcmVhdGUgYSBuZXcgQVBJIDogRmRP
QkVYX1NldFRyYW5zcG9ydEZvcm1hdC4gIElgbGwgdXBkYXRlIG15IHBhdGNoZXMgaW4gbmV3IG1h
aWxzLg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogSGVuZHJpayBTYXR0bGVy
IFttYWlsdG86cG9zdEBoZW5kcmlrLXNhdHRsZXIuZGVdIA0KU2VudDogMjAxMcTqNtTCMjHI1SA0
OjQ0DQpUbzogb3Blbm9iZXgtdXNlcnNAbGlzdHMuc291cmNlZm9yZ2UubmV0DQpDYzogTWFyY2Vs
IEhvbHRtYW5uOyBMaSwgTmFtaTsgTGl1LCBIYWlqdW47IGxpbnV4LWJsdWV0b290aEB2Z2VyLmtl
cm5lbC5vcmcNClN1YmplY3Q6IFJlOiBbb3Blbm9iZXgtdXNlcnNdIFtQQVRDSCBvcGVub2JleCAx
LzNd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GhlIA0KPiA+IGFwcGxpY2F0aW9uIGp1c3QgdGVsbHMgeW91
PyBPVE9ILCB0aGUgYXBwbGljYXRpb24gY291bGQganVzdCB1c2UgYSBjdXN0b20gdHJhbnNwb3J0
LCB0aGVuLg0KPiANCj4gcHJvYmxlbSBpcyB0aGF0IGVpdGhlciB3ZSBpbnRyb2R1Y2UgYSBuZXcg
YWJzdHJhY3Rpb24gb3Igd2UgZmlndXJlIA0KPiB0aGlzIG91dCBtYWdpY2FsbHkuIEJyZWFraW5n
IHRoZSBBUEkgbGlrZSB0aGlzIGlzIG5vdCBhIGdvb2QgaWRlYS4NCj4gDQo+IFNvIGlmIHdlIGdv
IGZvciBGZFBhY2tldE9CRVggb3Igc29tZXRoaW5nIGl0IG1pZ2h0IGJlIGEgcG9zc2libGUgDQo+
IG9wdGlvbiwgYnV0IGJyZWFraW5nIEZkT0JFWCBBUEkgaXMgbm90IGFuIG9wdGlvbi4NCg0KSG93
IGFib3V0IGEgbmV3IGZ1bmN0aW9uOg0Kdm9pZCBGZE9CRVhfU2V0VHJhbnNwb3J0Rm9ybWF0KG9i
ZXhfdCAqc2VsZiwgZW51bSBmZG9iZXhfdHJhbnNwb3J0X2Zvcm1hdCBmbXQpOw0KDQpTaG91bGQg
bm90IGJyZWFrIGFueXRoaW5nIDopDQoNCkhTDQo=
Hi,
Am Montag, 20. Juni 2011, 21:45:11 schrieb Marcel Holtmann:
> > > > include/openobex/obex_const.h | 4 ++++
> > > > lib/fdobex.h | 1 +
> > > > 2 files changed, 5 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/include/openobex/obex_const.h
> > > > b/include/openobex/obex_const.h index cb7afeb..8acee91 100644
> > > > --- a/include/openobex/obex_const.h
> > > > +++ b/include/openobex/obex_const.h
> > > > @@ -302,6 +302,10 @@ enum obex_rsp_mode {
> > > >
> > > > OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
> > > >
> > > > };
> > > >
> > > > +enum fdobex_transport_format{
> > > > + FDOBEX_MT_STREAM ,
> > > > + FDOBEX_MT_SEQPACKET
> > > > +};
> > >
> > > can I ask again why we should be doing this. Especially for the FdOBEX
> > > transport this is pointless. You are getting a file descriptor in the
> > > first place. It does not have to be a socket.
> > >
> > > And in the case this is really a socket, then you can just use SO_TYPE
> > > to read the current type of the socket.
> > >
> > > If it is not a socket, then it needs to treated as stream anyway.
> >
> > No. Ever tried that on the linux USB gadget implementation in Linux? If a
> > FD is not pointing to a socket, it can still point to a device file of
> > whatever kind. You SO_TYPE won't completely help here. You can try any
> > amount of guessing but isn't it easier if the application just tells
> > you? OTOH, the application could just use a custom transport, then.
>
> problem is that either we introduce a new abstraction or we figure this
> out magically. Breaking the API like this is not a good idea.
>
> So if we go for FdPacketOBEX or something it might be a possible option,
> but breaking FdOBEX API is not an option.
How about a new function:
void FdOBEX_SetTransportFormat(obex_t *self, enum fdobex_transport_format
fmt);
Should not break anything :)
HS
Hi Hendrik,
> > > include/openobex/obex_const.h | 4 ++++
> > > lib/fdobex.h | 1 +
> > > 2 files changed, 5 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/include/openobex/obex_const.h
> > > b/include/openobex/obex_const.h index cb7afeb..8acee91 100644
> > > --- a/include/openobex/obex_const.h
> > > +++ b/include/openobex/obex_const.h
> > > @@ -302,6 +302,10 @@ enum obex_rsp_mode {
> > >
> > > OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
> > >
> > > };
> > >
> > > +enum fdobex_transport_format{
> > > + FDOBEX_MT_STREAM ,
> > > + FDOBEX_MT_SEQPACKET
> > > +};
> >
> > can I ask again why we should be doing this. Especially for the FdOBEX
> > transport this is pointless. You are getting a file descriptor in the
> > first place. It does not have to be a socket.
> >
> > And in the case this is really a socket, then you can just use SO_TYPE
> > to read the current type of the socket.
> >
> > If it is not a socket, then it needs to treated as stream anyway.
>
> No. Ever tried that on the linux USB gadget implementation in Linux? If a FD
> is not pointing to a socket, it can still point to a device file of whatever
> kind. You SO_TYPE won't completely help here. You can try any amount of
> guessing but isn't it easier if the application just tells you? OTOH, the
> application could just use a custom transport, then.
problem is that either we introduce a new abstraction or we figure this
out magically. Breaking the API like this is not a good idea.
So if we go for FdPacketOBEX or something it might be a possible option,
but breaking FdOBEX API is not an option.
Regards
Marcel
Am Montag, 20. Juni 2011, 18:43:10 schrieb Marcel Holtmann:
> Hi Nami,
>
> > include/openobex/obex_const.h | 4 ++++
> > lib/fdobex.h | 1 +
> > 2 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/openobex/obex_const.h
> > b/include/openobex/obex_const.h index cb7afeb..8acee91 100644
> > --- a/include/openobex/obex_const.h
> > +++ b/include/openobex/obex_const.h
> > @@ -302,6 +302,10 @@ enum obex_rsp_mode {
> >
> > OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
> >
> > };
> >
> > +enum fdobex_transport_format{
> > + FDOBEX_MT_STREAM ,
> > + FDOBEX_MT_SEQPACKET
> > +};
>
> can I ask again why we should be doing this. Especially for the FdOBEX
> transport this is pointless. You are getting a file descriptor in the
> first place. It does not have to be a socket.
>
> And in the case this is really a socket, then you can just use SO_TYPE
> to read the current type of the socket.
>
> If it is not a socket, then it needs to treated as stream anyway.
No. Ever tried that on the linux USB gadget implementation in Linux? If a FD
is not pointing to a socket, it can still point to a device file of whatever
kind. You SO_TYPE won't completely help here. You can try any amount of
guessing but isn't it easier if the application just tells you? OTOH, the
application could just use a custom transport, then.
HS
Hi Nami,
> include/openobex/obex_const.h | 4 ++++
> lib/fdobex.h | 1 +
> 2 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/include/openobex/obex_const.h b/include/openobex/obex_const.h
> index cb7afeb..8acee91 100644
> --- a/include/openobex/obex_const.h
> +++ b/include/openobex/obex_const.h
> @@ -302,6 +302,10 @@ enum obex_rsp_mode {
> OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
> };
>
> +enum fdobex_transport_format{
> + FDOBEX_MT_STREAM ,
> + FDOBEX_MT_SEQPACKET
> +};
can I ask again why we should be doing this. Especially for the FdOBEX
transport this is pointless. You are getting a file descriptor in the
first place. It does not have to be a socket.
And in the case this is really a socket, then you can just use SO_TYPE
to read the current type of the socket.
If it is not a socket, then it needs to treated as stream anyway.
Regards
Marcel
Zitat von Nami <[email protected]>:
> ---
> include/openobex/obex_const.h | 4 ++++
> lib/fdobex.h | 1 +
> 2 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/include/openobex/obex_const.h b/include/openobex/obex_const.h
> index cb7afeb..8acee91 100644
> --- a/include/openobex/obex_const.h
> +++ b/include/openobex/obex_const.h
> @@ -302,6 +302,10 @@ enum obex_rsp_mode {
> OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
> };
>
> +enum fdobex_transport_format{
> + FDOBEX_MT_STREAM ,
> + FDOBEX_MT_SEQPACKET
> +};
> /* Min, Max and default transport MTU */
> #define OBEX_DEFAULT_MTU 1024
> #define OBEX_MINIMUM_MTU 255
Insert an empty line after the enum, please.
Also document the enum and its members, see the enum above. This is
needed for the doxygen output.
> diff --git a/lib/fdobex.h b/lib/fdobex.h
> index 07e33ab..6839e77 100644
> --- a/lib/fdobex.h
> +++ b/lib/fdobex.h
> @@ -6,5 +6,6 @@ void fdobex_get_ops(struct obex_transport_ops* ops);
>
> struct fdobex_data {
> socket_t writefd; /* write descriptor */
> + enum fdobex_transport_format fmt;
> };
> #endif
> --
> 1.7.1
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Openobex-users mailing list
> [email protected]
> http://lists.sourceforge.net/lists/listinfo/openobex-users
>
Hi Nami,
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nami
Sent: Monday, June 20, 2011 11:17 AM
To: [email protected]
Cc: Liu, Haijun; [email protected]; Li, Nami
Subject: [PATCH openobex 1/3] Add transport format member in fdobex_data struct. Support STREAM and SEQPACKET transport format.
---
include/openobex/obex_const.h | 4 ++++
lib/fdobex.h | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
I think you should limit the number of characters in the subject to around 72 odd.
Any explanation can be added in the beginning of the patch.
Regards
Suraj
---
lib/fdobex.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/fdobex.c b/lib/fdobex.c
index 45c56ff..7a44fbd 100644
--- a/lib/fdobex.c
+++ b/lib/fdobex.c
@@ -78,6 +78,8 @@ 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)
+ buflen = self->mtu_rx;
#ifdef _WIN32
return _read(trans->fd, buf, buflen);
#else
--
1.7.1
---
include/openobex/obex.h | 2 +-
lib/obex.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/openobex/obex.h b/include/openobex/obex.h
index f948113..0d7afec 100644
--- a/include/openobex/obex.h
+++ b/include/openobex/obex.h
@@ -147,7 +147,7 @@ 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(int) FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu, int fmt);
/*
* OBEX interface discovery API
diff --git a/lib/obex.c b/lib/obex.c
index 165fcb8..304bc15 100644
--- a/lib/obex.c
+++ b/lib/obex.c
@@ -1116,10 +1116,11 @@ int CALLAPI BtOBEX_TransportConnect(obex_t *self, bdaddr_t *src,
\param rfd descriptor to read
\param wfd descriptor to write
\param mtu transport mtu: 0 - default
+ \param fmt transport format: 0 - default
\return -1 or negative error code on error
*/
LIB_SYMBOL
-int CALLAPI FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu)
+int CALLAPI FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu, int fmt)
{
DEBUG(4, "\n");
@@ -1132,6 +1133,7 @@ int CALLAPI FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu)
self->trans.fd = rfd;
self->trans.data.fd.writefd = wfd;
self->trans.mtu = mtu ? mtu : self->mtu_tx_max;
+ self->trans.data.fd.fmt = fmt;
return obex_transport_connect_request(self);
}
--
1.7.1