Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] Wakaama based client not working with Leshan bootstrap

Hi David,

I finally figured out the issue why the wakaama lwm2mclient works on my linux box but not in my embedded client. 

The reason is in embedded env the compiler treats "coap_content_type_t" enum in "er-coap-13.h" as uint8_t based on this enums range i.e 

/* CoAP Content-Types */
typedef enum {
  TEXT_PLAIN = 0,
  TEXT_XML = 1, /* Indented types are not in the initial registry. */
  TEXT_CSV = 2,
  TEXT_HTML = 3,
  IMAGE_GIF = 21,
  IMAGE_JPEG = 22,
  IMAGE_PNG = 23,
  IMAGE_TIFF = 24,
  AUDIO_RAW = 25,
  VIDEO_RAW = 26,
  APPLICATION_LINK_FORMAT = 40,
  APPLICATION_XML = 41,
  APPLICATION_OCTET_STREAM = 42,
  APPLICATION_RDF_XML = 43,
  APPLICATION_SOAP_XML = 44,
  APPLICATION_ATOM_XML = 45,
  APPLICATION_XMPP_XML = 46,
  APPLICATION_EXI = 47,
  APPLICATION_FASTINFOSET = 48,
  APPLICATION_SOAP_FASTINFOSET = 49,
  APPLICATION_JSON = 50,
  APPLICATION_X_OBIX_BINARY = 51,
} coap_content_type_t;
 
Whereas the client built on the linux box its at least of size uint16_t. This causes the total size of the "struct coap_packet_t" to be different in both envs.
Hence when a packet is received from the leshan server of Content Type > 255 like 
	LWM2M_CONTENT_TLV       = 1542,    //0x606
    	LWM2M_CONTENT_JSON      = 1543   //0x607

The content type is being truncated to 0x6. So the wakaama client misbehaves when functions like "format = utils_convertMediaType(message->content_type);" are called in bootstrap.c line 335. 

I think this is a portability issue in Wakaama Client and I leave it to you if think this should be fixed. My resolution for the time being was to force "coap_content_type_t " enum to be of size uint16_t at least by doing this :

/* CoAP Content-Types */
typedef enum {
  TEXT_PLAIN = 0,
  TEXT_XML = 1, /* Indented types are not in the initial registry. */
  TEXT_CSV = 2,
  TEXT_HTML = 3,
  IMAGE_GIF = 21,
  IMAGE_JPEG = 22,
  IMAGE_PNG = 23,
  IMAGE_TIFF = 24,
  AUDIO_RAW = 25,
  VIDEO_RAW = 26,
  APPLICATION_LINK_FORMAT = 40,
  APPLICATION_XML = 41,
  APPLICATION_OCTET_STREAM = 42,
  APPLICATION_RDF_XML = 43,
  APPLICATION_SOAP_XML = 44,
  APPLICATION_ATOM_XML = 45,
  APPLICATION_XMPP_XML = 46,
  APPLICATION_EXI = 47,
  APPLICATION_FASTINFOSET = 48,
  APPLICATION_SOAP_FASTINFOSET = 49,
  APPLICATION_JSON = 50,
  APPLICATION_X_OBIX_BINARY = 51,
++	Internal_ForceMyEnumIntSize = 65535
} coap_content_type_t;

This will also make sure the "coap_packet_t" struct also aligns correctly in both envs.

Regards
Vibhor
-----Original Message-----
From: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] On Behalf Of wakaama-dev-request@xxxxxxxxxxx
Sent: Wednesday, March 30, 2016 8:06 AM
To: wakaama-dev@xxxxxxxxxxx
Subject: wakaama-dev Digest, Vol 20, Issue 16

Send wakaama-dev mailing list submissions to
	wakaama-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
	https://dev.eclipse.org/mailman/listinfo/wakaama-dev
or, via email, send a message with subject or body 'help' to
	wakaama-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
	wakaama-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific than "Re: Contents of wakaama-dev digest..."


Today's Topics:

   1. Re: Wakaama based client not working with	Leshan	bootstrap
      server (Navarro, David)


----------------------------------------------------------------------

Message: 1
Date: Wed, 30 Mar 2016 15:06:05 +0000
From: "Navarro, David" <david.navarro@xxxxxxxxx>
To: Wakaama developer discussions <wakaama-dev@xxxxxxxxxxx>
Subject: Re: [wakaama-dev] Wakaama based client not working with
	Leshan	bootstrap server
Message-ID:
	<D4775DF50A67AE42A7B3D9F6517B87865D12AD41@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
	
Content-Type: text/plain; charset="us-ascii"

Hi,

> I seems like the client is trying to create a new server object. Shouldn't the server object created during initialization be changed at this step instead of a new one being created ?

The client tries to create new instances of the security and server objects. The one created during initialization describes the Bootstrap Server. You need new instances to store information for the provisionned LWM2M server.

Since step 3 is failing, next steps are normal.

Regards,
David Navarro

From: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] On Behalf Of Kalley, Vibhor
Sent: Wednesday, 30 March, 2016 11:41
To: wakaama-dev@xxxxxxxxxxx
Subject: [wakaama-dev] Wakaama based client not working with Leshan bootstrap server

Hi,

I have written a wakaama client which is very similar to the testlwm2mclient except for some platform specific functions for connection and my own 1024 object. I am unable to get this client to complete bootstrapping and talk to the leshan server. Here are my steps and some observations:

Step 1: Start the leshan-bs-server on port 5783 using $> java -jar ./leshan-bsserver-demo.jar -lp 5783 -wp 8081 Step 2 : Add client registration info using bs-server UI , NoSec Step 3 : Run my client configured to talk to the BS server .
                Observation 1: I see that client works fine until it receives a call from BS server to change Server Resource /1/0 . My client replies with a 4.00 Bad Request [cid:image001.png@01D18AA5.DA18F280]


Here is the call stack at this step in Wakaama code.

[cid:image002.png@01D18AA5.DA18F280]

I seems like the client is trying to create a new server object. Shouldn't the server object created during initialization be changed at this step instead of a new one being created ?

Step 4: Anyways as you can see from the Wireshark capture that the BS steps do complete even with the error.
Step 5: Now when the next lwm2m_step() is called in the Wakaama client it comes back with an error 0xA3 Step 6: Inside lwm2m_step the client has the valid status of STATE_BS_FINISHED but it fails when it starts the registration at the below red line

int lwm2m_step(lwm2m_context_t * contextP,
               time_t * timeoutP)
{
    time_t tv_sec;
    int result;

    tv_sec = lwm2m_gettime();
    if (tv_sec < 0) return COAP_500_INTERNAL_SERVER_ERROR;

#ifdef LWM2M_CLIENT_MODE
    // state can also be modified in handle_bootstrap_command().

next_step:
    switch (contextP->state)
    {
    case STATE_INITIAL:
        if (0 != refresh_server_list(contextP)) return COAP_503_SERVICE_UNAVAILABLE;


The testlwm2mclient works fine in this setup and also  my client has a similar issue with Wakaama Bootstrap Server.

Please let know if there is anything else that I should try ?
Am I  missing some configuration or setup on the Leshan-BS-demo-server for my client?
FYI my Wakaama copy is from 12 days ago, right after the reorganization of the Directory structure.

Thanks
Vibhor
________________________________
NOTICE OF CONFIDENTIALITY:
This message may contain information that is considered confidential and which may be prohibited from disclosure under applicable law or by contractual agreement. The information is intended solely for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the information contained in or attached to this message is strictly prohibited. If you have received this email transmission in error, please notify the sender by replying to this email and then delete it from your system.
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/wakaama-dev/attachments/20160330/49a539ab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 58861 bytes
Desc: image001.png
URL: <https://dev.eclipse.org/mailman/private/wakaama-dev/attachments/20160330/49a539ab/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 74261 bytes
Desc: image002.png
URL: <https://dev.eclipse.org/mailman/private/wakaama-dev/attachments/20160330/49a539ab/attachment-0001.png>

------------------------------

_______________________________________________
wakaama-dev mailing list
wakaama-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/wakaama-dev

End of wakaama-dev Digest, Vol 20, Issue 16
*******************************************


Back to the top