Iot sdk thesis


Resolving the UNIX dependency



Download 2,28 Mb.
Pdf ko'rish
bet43/52
Sana26.04.2022
Hajmi2,28 Mb.
#584210
1   ...   39   40   41   42   43   44   45   46   ...   52
Bog'liq
EIT Thesis IoT SDK by Hrudaynath

Resolving the UNIX dependency:

Only Check for matching ifindex, size and remoteIpStr 
Design Decision: 
After adjusting the structure 
session_t, 
only these three variables 
can uniquely identify a session.
Hence, the function reduces to a much simpler form which can be used on Arduino-like boards 

static
inline
int
_dtls_address_equals_impl(
const
session_t *a, 
const
session_t *b)

if
(a->ifindex != b->ifindex || a->size != b->size ) 
return
0

//Added else for SODAQ
else

return
strcmp(a->addr.remoteIpStr, b->addr.remoteIpStr); 


Sessions API has been made Arduino-compliant as shown in this section. Now let’s 
move to a more complex - DTLS Connections - API. 
3.3.3
 
DTLS Connections API (dtlsconnection.c, dtlsconnection.h) 
‘DTLS Connections’ API has a structure and multiple functions implemented, that use 
UNIX libraries mentioned above. The structure 
dtls_connection_t 
is used to store the 
information specific to a partifular DTLS connection, has only one UNIX dependency, which 
has been shown in red below: 
typedef
struct
_dtls_connection_t 

struct
_dtls_connection_t * next; 
int
sock; 
struct
sockaddr_in6 addr

size_t addrLen; 
session_t * dtlsSession; 
lwm2m_object_t * securityObj; 
int
securityInstId; 
lwm2m_context_t * lwm2mH; 
dtls_context_t * dtlsContext; 
time_t lastSend;
} dtls_connection_t; 


58 
Resolving the UNIX dependency: 
Similar to 
session_t, 
the UNIX-specific dependencies 
had to be removed and compensated for by a string for IP address, an integer for port and a 
Sodaq_nbIOT object to access the SODAQ NB-IoT API. The SODAQ SARA compatible 
structure has been shown below: 
typedef
struct
_dtls_connection_t 

struct
_dtls_connection_t * next; 
int
sock;
//struct sockaddr_in6 addr;
//size_t addrLen; //Removed, since it is not required
/*Added for SODAQ Integration*/
Sodaq_nbIOT * nbIOT; 
//Sodaq_nbIOT object to access the SODAQ NB-IoT API
char
* remoteIpStr; 
//To store remote IP address
uint16_t
port; 
//to store remote port
session_t * dtlsSession; 
lwm2m_object_t * securityObj; 
int
securityInstId; 
lwm2m_context_t * lwm2mH; 
dtls_context_t * dtlsContext; 
time_t
lastSend; 
// last time a data was sent to the server (used for NAT 
timeouts)
} dtls_connection_t; 
Now we will see the functions in DTLS Connection API. The most important functions, 
their functionalities and dependencies on UNIX dependencies have been shown below. The 
‘red’ parts indicate UNIX-dependent functions or variables. 
(NOTE: Although every function with socket dependency was studied, adjusted or made 
redundant for making Wakaama with DTLS portable to SODAQ SARA, only a notable few 
have been discussed in this section. The purpose it to give readers a general idea of dependency 
resolution in concise text for better readability.)


59 
/* Returns the number sent packets to the address stored in ConnP->addr, or -1 for 
errors */
int
send_data(dtls_connection_t *connP, uint8_t * buffer, size_t length) 

/* 
*other source lines* 
*/
// sendto() function from sys/socket.h is used to message to connP->addr
nbSent = 
sendto
(connP->sock,
buffer + offset, 
length - offset,
0
, (
struct
sockaddr *)&(connP->addr),
connP->addrLen); 
/*
*other source lines* 
*/
return nbSent; 
}

Download 2,28 Mb.

Do'stlaringiz bilan baham:
1   ...   39   40   41   42   43   44   45   46   ...   52




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish