eclipse-californium / californium

CoAP/DTLS Java Implementation
https://www.eclipse.org/californium/
Other
729 stars 367 forks source link

Californium compliance to CBoR RFC 7049 #663

Closed jas-singh14 closed 5 years ago

jas-singh14 commented 6 years ago

Please let us know compliance of Californium w.r.t RFC 7049 (CBOR support).

sophokles73 commented 6 years ago

what is to support?

jas-singh14 commented 6 years ago

Does Cf provides functionality of CBOR encoding/decoding OR we need to find an separate library for supporting CBOR encoding/decoding functionality?

boaks commented 6 years ago

Though payload format is not the scope of californium, it's not provided with californium. We also do not provided an XML parser nor JSON support (even if some examples import a JSON library). We also do not mention that functionality in the page, I provided the links already in your other question #661

jas-singh14 commented 6 years ago

Any suggestions for the CBOR library? As of now we are evaluating two libraries peteroupc library(https://github.com/peteroupc/CBOR-Java) and c-rack library(https://github.com/c-rack/cbor-java)? Also do these libraries interoperate (client from one library can talk to server with another library)? I know this is not Cf question per-se, but probably you can answer based on past experience/expertise. Thanks in advance.

boaks commented 6 years ago

I personally have no experience with CBOR but I would recommend then to change the title asking for a CBOR java implementation recommendation, or even better, close this issue and create a new one.

jas-singh14 commented 6 years ago

thanks for the valuable inputs. I am closing this..

jiangyoudi commented 5 years ago

Dear, CBOR not support, but MediaTypeRegistry has the fllowing type ,what's used to do?

CoapResponse resp = client.post(payload, MediaTypeRegistry.APPLICATION_JSON); CoapResponse resp = client.post(payload, MediaTypeRegistry.APPLICATION_CBOR); CoapResponse resp = client.post(payload, MediaTypeRegistry.APPLICATION_VND_OMA_LWM2M_TLV);

boaks commented 5 years ago

Dear, CBOR not support, but MediaTypeRegistry has the fllowing type ,what's used to do?

Sorry, there is is general misunderstanding in the "responsibilities". Californium offer the transport of payload as bytes, the encoding and decoding of these bytes is the responsibility of the application layer on the top of californium. There are plenty media types registered at iana (see https://www.iana.org/assignments/media-types/media-types.xhtml) and support them all with encoding/decoding doesn't make sense.

e.g.: If you application want to use JSON, you may just import the json parser and serializer of your choice and use that to encoding and decoding your JSON into or from bytes. For the cf-extplugtest-server/client we import google's json parser as "pom dependency".

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.8.2</version>
</dependency>

In the meantime, the ri.se has spent a OSCORE implementation, which uses CBOR on it's own. Therefore that OSCORE module imports

<dependency>
  <groupId>com.upokecenter</groupId>
  <artifactId>cbor</artifactId>
  <version>3.0.3</version>
</dependency>

If you want to use the OSCORE module, you may also use that CBOR implementation, if the license of that implementation fits your requirements. General, you free to chose your parser/serializer.

Does this answer help you to understand, what californium does for you, and what must be done by yourself?

jiangyoudi commented 5 years ago

Dear, CBOR not support, but MediaTypeRegistry has the fllowing type ,what's used to do?

Sorry, there is is general misunderstanding in the "responsibilities". Californium offer the transport of payload as bytes, the encoding and decoding of these bytes is the responsibility of the application layer on the top of californium. There are plenty media types registered at iana (see https://www.iana.org/assignments/media-types/media-types.xhtml) and support them all with encoding/decoding doesn't make sense.

e.g.: If you application want to use JSON, you may just import the json parser and serializer of your choice and use that to encoding and decoding your JSON into or from bytes. For the cf-extplugtest-server/client we import google's json parser as "pom dependency".

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.8.2</version>
</dependency>

In the meantime, the ri.se has spent a OSCORE implementation, which uses CBOR on it's own. Therefore that OSCORE module imports

<dependency>
  <groupId>com.upokecenter</groupId>
  <artifactId>cbor</artifactId>
  <version>3.0.3</version>
</dependency>

If you want to use the OSCORE module, you may also use that CBOR implementation, if the license of that implementation fits your requirements. General, you free to chose your parser/serializer.

Does this answer help you to understand, what californium does for you, and what must be done by yourself?

Thand for

Dear, CBOR not support, but MediaTypeRegistry has the fllowing type ,what's used to do?

Sorry, there is is general misunderstanding in the "responsibilities". Californium offer the transport of payload as bytes, the encoding and decoding of these bytes is the responsibility of the application layer on the top of californium. There are plenty media types registered at iana (see https://www.iana.org/assignments/media-types/media-types.xhtml) and support them all with encoding/decoding doesn't make sense.

e.g.: If you application want to use JSON, you may just import the json parser and serializer of your choice and use that to encoding and decoding your JSON into or from bytes. For the cf-extplugtest-server/client we import google's json parser as "pom dependency".

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.8.2</version>
</dependency>

In the meantime, the ri.se has spent a OSCORE implementation, which uses CBOR on it's own. Therefore that OSCORE module imports

<dependency>
  <groupId>com.upokecenter</groupId>
  <artifactId>cbor</artifactId>
  <version>3.0.3</version>
</dependency>

If you want to use the OSCORE module, you may also use that CBOR implementation, if the license of that implementation fits your requirements. General, you free to chose your parser/serializer.

Does this answer help you to understand, what californium does for you, and what must be done by yourself?

Thanks for your help,I get it.Have a good day for you~~~

boaks commented 5 years ago

your welcome.