Commit 838bea4a authored by David Antler's avatar David Antler

VS2013/15 aggregate changes of Intel and Microsoft

Status: Compiles in VS2015 and runs tests

List of TODOs:

  TODO: Fix tinydtls tick and locking issues.
  TODO: Fix disabled tests (PersistentStorageHandlerTest, usleep)
  TODO: Enable ocpmapi.dll shared lib (currently it's static)
  TODO: Remove hacks to solve error C2059: syntax error: 'constant'
          see: resource\include\StringConstants.h
  TODO: Address inconsistent style! Perhaps file a JIRA issue; CI
        should reject such issues before they enter the code base.
  TODO: Understand priority around enabling services.

Merger changelog:

* Adopted libtimer\timer.c changes from Microsoft
* Adopted Boost SCons installation changes from Intel
* Combined build_common\windows\SConscript from both Intel and
  Microsoft
* Adopted tinydtls code changes from Microsoft (INLINE_API macro,
  features wrapped in #ifdefs, etc)
* Adopted tinydtls SCons changes from Intel, tinydtls random seed
  generation from Intel
* Adopted ocrandom.c "QueryPerformanceCounter" from Microsoft.
* Adopted resource\examples from Intel
* Adopted liboc_logger and liboc from Intel
* Adopted resource/src from Intel
* Adopted boostification from Microsoft (BOOST_NOEXCEPT, etc.)
* Adopted "getopt" from Microsoft (multiple locations)
  - resource\csdk\stack\samples\linux\secure\occlientbasicops.cpp
  - resource\csdk\stack\samples\linux\SimpleClientServer\common.cpp
* Adopted SimpleClientServer changes from Microsoft
  - resource\csdk\stack\samples\linux\SimpleClientServer\
* Adopted oicgroup.c from Intel
* Adopted OC_EXPORT changes (and OC_EXPORT_DLL define macro)
  from Microsoft

Change-Id: Ib4298cd63731b39e1bcfa6a790fd18298c73720a
Signed-off-by: default avatarHenry Beberman <henry.beberman@intel.com>
Signed-off-by: default avatarDave Thaler <dthaler@microsoft.com>
Signed-off-by: default avatarDaniel Ferguson <daniel.j.ferguson@intel.com>
Signed-off-by: default avatarDavid Antler <david.a.antler@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7627Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent 760b08dc
......@@ -97,7 +97,7 @@ extlibs/android/sdk/android-sdk_r24.2
extlibs/android/sdk/android-sdk-linux
extlibs/android/sdk/android-sdk-macosx
extlibs/android/sdk/android-sdk-windows
extlibs/boost/boost_1_58_0
extlibs/boost/*
extlibs/tinycbor/tinycbor
*.tgz
*.zip
......
......@@ -307,48 +307,55 @@ def generate( env ) :
# read tools for Windows system
if env["PLATFORM"] <> "darwin" and "win" in env["PLATFORM"] :
if env.WhereIs("7z") :
if env.WhereIs('7z', env.get('PATH')):
toolset["EXTRACTOR"]["TARGZ"]["RUN"] = "7z"
toolset["EXTRACTOR"]["TARGZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["TARGZ"]["LISTFLAGS"] = "x"
toolset["EXTRACTOR"]["TARGZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"
toolset["EXTRACTOR"]["TARGZ"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["TARGZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -o${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["TARBZ"]["RUN"] = "7z"
toolset["EXTRACTOR"]["TARBZ"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["TARBZ"]["LISTFLAGS"] = "x"
toolset["EXTRACTOR"]["TARBZ"]["LISTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} l -sii -ttar -y -so"
toolset["EXTRACTOR"]["TARBZ"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["TARBZ"]["EXTRACTSUFFIX"] = "-so -y | ${UNPACK['EXTRACTOR']['TARGZ']['RUN']} x -sii -ttar -y -o${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["BZIP"]["RUN"] = "7z"
toolset["EXTRACTOR"]["BZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["BZIP"]["LISTFLAGS"] = "l"
toolset["EXTRACTOR"]["BZIP"]["LISTSUFFIX"] = "-y -so"
toolset["EXTRACTOR"]["BZIP"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["BZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["BZIP"]["EXTRACTSUFFIX"] = "-y -o${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["GZIP"]["RUN"] = "7z"
toolset["EXTRACTOR"]["GZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["GZIP"]["LISTFLAGS"] = "l"
toolset["EXTRACTOR"]["GZIP"]["LISTSUFFIX"] = "-y -so"
toolset["EXTRACTOR"]["GZIP"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["GZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["GZIP"]["EXTRACTSUFFIX"] = "-y -o${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["ZIP"]["RUN"] = "7z"
toolset["EXTRACTOR"]["ZIP"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["ZIP"]["LISTFLAGS"] = "l"
toolset["EXTRACTOR"]["ZIP"]["LISTSUFFIX"] = "-y -so"
toolset["EXTRACTOR"]["ZIP"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-y -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["ZIP"]["EXTRACTSUFFIX"] = "-y -o${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["TAR"]["RUN"] = "7z"
toolset["EXTRACTOR"]["TAR"]["LISTEXTRACTOR"] = __fileextractor_win_7zip
toolset["EXTRACTOR"]["TAR"]["LISTFLAGS"] = "l"
toolset["EXTRACTOR"]["TAR"]["LISTSUFFIX"] = "-y -ttar -so"
toolset["EXTRACTOR"]["TAR"]["EXTRACTFLAGS"] = "x"
toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-y -ttar -oc:${UNPACK['EXTRACTDIR']}"
toolset["EXTRACTOR"]["TAR"]["EXTRACTSUFFIX"] = "-y -ttar -o${UNPACK['EXTRACTDIR']}"
else:
print '''*********************** Error ************************
* *
* Please make sure that 7-zip is in your System PATH *
* *
******************************************************
'''
# here can add some other Windows tools, that can handle the archive files
# but I don't know which ones can handle all file types
......
......@@ -39,6 +39,8 @@ extern "C"
#define cJSON_IsReference 256
#include <platform_features.h>
/* The cJSON structure: */
typedef struct cJSON {
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
......@@ -59,71 +61,71 @@ typedef struct cJSON_Hooks {
} cJSON_Hooks;
/* Supply malloc, realloc and free functions to cJSON */
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
OC_EXPORT extern void cJSON_InitHooks(cJSON_Hooks* hooks);
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
extern cJSON *cJSON_Parse(const char *value);
OC_EXPORT extern cJSON *cJSON_Parse(const char *value);
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
extern char *cJSON_Print(cJSON *item);
OC_EXPORT extern char *cJSON_Print(cJSON *item);
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
extern char *cJSON_PrintUnformatted(cJSON *item);
OC_EXPORT extern char *cJSON_PrintUnformatted(cJSON *item);
/* Delete a cJSON entity and all subentities. */
extern void cJSON_Delete(cJSON *c);
OC_EXPORT extern void cJSON_Delete(cJSON *c);
/* Returns the number of items in an array (or object). */
extern int cJSON_GetArraySize(cJSON *array);
OC_EXPORT extern int cJSON_GetArraySize(cJSON *array);
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
OC_EXPORT extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
/* Get item "string" from object. Case insensitive. */
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
OC_EXPORT extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
extern const char *cJSON_GetErrorPtr(void);
OC_EXPORT extern const char *cJSON_GetErrorPtr(void);
/* These calls create a cJSON item of the appropriate type. */
extern cJSON *cJSON_CreateNull(void);
extern cJSON *cJSON_CreateTrue(void);
extern cJSON *cJSON_CreateFalse(void);
extern cJSON *cJSON_CreateBool(int b);
extern cJSON *cJSON_CreateNumber(double num);
extern cJSON *cJSON_CreateString(const char *string);
extern cJSON *cJSON_CreateArray(void);
extern cJSON *cJSON_CreateObject(void);
OC_EXPORT extern cJSON *cJSON_CreateNull(void);
OC_EXPORT extern cJSON *cJSON_CreateTrue(void);
OC_EXPORT extern cJSON *cJSON_CreateFalse(void);
OC_EXPORT extern cJSON *cJSON_CreateBool(int b);
OC_EXPORT extern cJSON *cJSON_CreateNumber(double num);
OC_EXPORT extern cJSON *cJSON_CreateString(const char *string);
OC_EXPORT extern cJSON *cJSON_CreateArray(void);
OC_EXPORT extern cJSON *cJSON_CreateObject(void);
/* These utilities create an Array of count items. */
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
OC_EXPORT extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
OC_EXPORT extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
OC_EXPORT extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
OC_EXPORT extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
/* Append item to the specified array/object. */
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
OC_EXPORT extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
OC_EXPORT extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
OC_EXPORT extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
OC_EXPORT extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
/* Remove/Detatch items from Arrays/Objects. */
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
OC_EXPORT extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
OC_EXPORT extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
OC_EXPORT extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
OC_EXPORT extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
/* Update array items. */
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
OC_EXPORT extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
OC_EXPORT extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
/* Duplicate a cJSON item */
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
OC_EXPORT extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
need to be released. With recurse!=0, it will duplicate any children connected to the item.
The item->next and ->prev pointers are always zero on return from Duplicate. */
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
OC_EXPORT extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
extern void cJSON_Minify(char *json);
OC_EXPORT extern void cJSON_Minify(char *json);
/* Macros for creating things quickly. */
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
......
......@@ -22,14 +22,26 @@
#define _BSD_SOURCE
#ifndef WITH_ARDUINO
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "platform_features.h"
#include <stdio.h>
#include "timer.h"
......@@ -255,9 +267,8 @@ void *loop(void *threadid)
int initThread()
{
int res;
long t = 0;
res = pthread_create(&thread_id, NULL, loop, (void *) t);
res = pthread_create(&thread_id, NULL, loop, NULL);
if (res)
{
......
......@@ -66,13 +66,13 @@ typedef enum {
* has finished */
#define DTLS_EVENT_RENEGOTIATE 0x01DF /**< re-negotiation has started */
static inline int
INLINE_API int
dtls_alert_create(dtls_alert_level_t level, dtls_alert_t desc)
{
return -((level << 8) | desc);
}
static inline int
INLINE_API int
dtls_alert_fatal_create(dtls_alert_t desc)
{
return dtls_alert_create(DTLS_ALERT_LEVEL_FATAL, desc);
......
......@@ -46,7 +46,7 @@
(A)[i] |= (C) & 0xFF; \
}
static inline void
INLINE_API void
block0(size_t M, /* number of auth bytes */
size_t L, /* number of bytes to encode message length */
size_t la, /* l(a) octets additional authenticated data */
......@@ -145,7 +145,7 @@ add_auth_data(rijndael_ctx *ctx, const unsigned char *msg, size_t la,
}
}
static inline void
INLINE_API void
encrypt(rijndael_ctx *ctx, size_t L, unsigned long counter,
unsigned char *msg, size_t len,
unsigned char A[DTLS_CCM_BLOCKSIZE],
......@@ -158,7 +158,7 @@ encrypt(rijndael_ctx *ctx, size_t L, unsigned long counter,
memxor(msg, S, len);
}
static inline void
INLINE_API void
mac(rijndael_ctx *ctx,
unsigned char *msg, size_t len,
unsigned char B[DTLS_CCM_BLOCKSIZE],
......
......@@ -60,7 +60,7 @@
#include "netq.h"
#include "hmac.h"
#ifndef WITH_CONTIKI
#if !defined(WITH_CONTIKI) && !defined(_WIN32)
#include <pthread.h>
#endif
......@@ -68,13 +68,13 @@
if (Seed) dtls_hmac_update(Context, (Seed), (Length))
static struct dtls_cipher_context_t cipher_context;
#ifndef WITH_CONTIKI
#if !defined(WITH_CONTIKI) && !defined(_WIN32)
static pthread_mutex_t cipher_context_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static struct dtls_cipher_context_t *dtls_cipher_context_get(void)
{
#ifndef WITH_CONTIKI
#if !defined(WITH_CONTIKI) && !defined(_WIN32)
pthread_mutex_lock(&cipher_context_mutex);
#endif
return &cipher_context;
......@@ -82,7 +82,7 @@ static struct dtls_cipher_context_t *dtls_cipher_context_get(void)
static void dtls_cipher_context_release(void)
{
#ifndef WITH_CONTIKI
#if !defined(WITH_CONTIKI) && !defined(_WIN32)
pthread_mutex_unlock(&cipher_context_mutex);
#endif
}
......
......@@ -158,7 +158,7 @@ typedef struct {
/* The following macros provide access to the components of the
* key_block in the security parameters. */
static inline int dtls_kb_mac_secret_size(dtls_cipher_t cipher)
INLINE_API int dtls_kb_mac_secret_size(dtls_cipher_t cipher)
{
switch(cipher)
{
......@@ -184,7 +184,7 @@ static inline int dtls_kb_mac_secret_size(dtls_cipher_t cipher)
}
static inline int dtls_kb_iv_size(dtls_cipher_t cipher)
INLINE_API int dtls_kb_iv_size(dtls_cipher_t cipher)
{
switch(cipher)
{
......
......@@ -87,7 +87,7 @@ static char *loglevels[] = {
#ifdef HAVE_TIME_H
static inline size_t
INLINE_API size_t
print_timestamp(char *s, size_t len, time_t t) {
struct tm *tmp;
tmp = localtime(&t);
......@@ -96,7 +96,7 @@ print_timestamp(char *s, size_t len, time_t t) {
#else /* alternative implementation: just print the timestamp */
static inline size_t
INLINE_API size_t
print_timestamp(char *s, size_t len, clock_time_t t) {
#ifdef HAVE_SNPRINTF
return snprintf(s, len, "%u.%03u",
......@@ -118,7 +118,7 @@ print_timestamp(char *s, size_t len, clock_time_t t) {
*
* @return The length of @p s.
*/
static inline size_t
INLINE_API size_t
dtls_strnlen(const char *s, size_t maxlen) {
size_t n = 0;
while(*s++ && n < maxlen)
......@@ -132,9 +132,9 @@ dtls_strnlen(const char *s, size_t maxlen) {
static size_t
dsrv_print_addr(const session_t *addr, char *buf, size_t len) {
#ifdef HAVE_ARPA_INET_H
#if defined(HAVE_ARPA_INET_H) || defined(_WIN32)
const void *addrptr = NULL;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(_WIN32)
unsigned short int port;
#else
in_port_t port;
......
......@@ -41,7 +41,7 @@
#ifdef CONTIKI_TARGET_MBXXX
extern char __Stack_Init, _estack;
static inline void check_stack() {
INLINE_API void check_stack() {
const char *p = &__Stack_Init;
while (p < &_estack && *p == 0x38) {
p++;
......@@ -50,13 +50,13 @@ static inline void check_stack() {
PRINTF("Stack: %d bytes used (%d free)\n", &_estack - p, p - &__Stack_Init);
}
#else /* CONTIKI_TARGET_MBXXX */
static inline void check_stack() {
INLINE_API void check_stack() {
}
#endif /* CONTIKI_TARGET_MBXXX */
#else /* WITH_CONTKI */
#define PRINTF(...)
static inline void check_stack() {
INLINE_API void check_stack() {
}
#endif
......@@ -102,28 +102,28 @@ void dtls_dsrv_log_addr(log_t level, const char *name, const session_t *addr);
#else /* NDEBUG */
static inline log_t dtls_get_log_level()
INLINE_API log_t dtls_get_log_level()
{
return DTLS_LOG_EMERG;
}
static inline void dtls_set_log_level(log_t level)
INLINE_API void dtls_set_log_level(log_t level)
{}
static inline void dsrv_log(log_t level, char *format, ...)
INLINE_API void dsrv_log(log_t level, char *format, ...)
{}
static inline void hexdump(const unsigned char *packet, int length)
INLINE_API void hexdump(const unsigned char *packet, int length)
{}
static inline void dump(unsigned char *buf, size_t len)
INLINE_API void dump(unsigned char *buf, size_t len)
{}
static inline void
INLINE_API void
dtls_dsrv_hexdump_log(log_t level, const char *name, const unsigned char *buf, size_t length, int extend)
{}
static inline void
INLINE_API void
dtls_dsrv_log_addr(log_t level, const char *name, const struct __session_t *addr)
{}
......
......@@ -28,10 +28,6 @@
#include "dtls_config.h"
#include "dtls_time.h"
#if defined(__msys_nt__)
#define _CRT_RAND_S
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_ASSERT_H
......@@ -142,23 +138,23 @@ PROCESS(dtls_retransmit_process, "DTLS retransmit process");
static dtls_context_t the_dtls_context;
static inline dtls_context_t *
INLINE_API dtls_context_t *
malloc_context() {
return &the_dtls_context;
}
static inline void
INLINE_API void
free_context(dtls_context_t *context) {
}
#else /* WITH_CONTIKI */
static inline dtls_context_t *
INLINE_API dtls_context_t *
malloc_context() {
return (dtls_context_t *)malloc(sizeof(dtls_context_t));
}
static inline void
INLINE_API void
free_context(dtls_context_t *context) {
free(context);
}
......@@ -409,7 +405,7 @@ is_record(uint8 *msg, size_t msglen) {
* \return pointer to the next byte after the written header.
* The length will be set to 0 and has to be changed before sending.
*/
static inline uint8 *
INLINE_API uint8 *
dtls_set_record_header(uint8 type, dtls_security_parameters_t *security,
uint8 *buf) {
......@@ -443,7 +439,7 @@ dtls_set_record_header(uint8 type, dtls_security_parameters_t *security,
* bytes. Increments message sequence number counter of \p peer.
* \return pointer to the next byte after \p buf
*/
static inline uint8 *
INLINE_API uint8 *
dtls_set_handshake_header(uint8 type, dtls_peer_t *peer,
int length,
int frag_offset, int frag_length,
......@@ -481,7 +477,7 @@ static uint8 compression_methods[] = {
};
/** returns true if the cipher matches TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 */
static inline int is_tls_ecdhe_ecdsa_with_aes_128_ccm_8(dtls_cipher_t cipher)
INLINE_API int is_tls_ecdhe_ecdsa_with_aes_128_ccm_8(dtls_cipher_t cipher)
{
#if defined(DTLS_ECC) || defined(DTLS_X509)
return cipher == TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
......@@ -491,7 +487,7 @@ static inline int is_tls_ecdhe_ecdsa_with_aes_128_ccm_8(dtls_cipher_t cipher)
}
/** returns true if the cipher matches TLS_PSK_WITH_AES_128_CCM_8 */
static inline int is_tls_psk_with_aes_128_ccm_8(dtls_cipher_t cipher)
INLINE_API int is_tls_psk_with_aes_128_ccm_8(dtls_cipher_t cipher)
{
#ifdef DTLS_PSK
return cipher == TLS_PSK_WITH_AES_128_CCM_8;
......@@ -501,7 +497,7 @@ static inline int is_tls_psk_with_aes_128_ccm_8(dtls_cipher_t cipher)
}
/** returns true if the cipher matches TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256 */
static inline int is_tls_ecdh_anon_with_aes_128_cbc_sha_256(dtls_cipher_t cipher)
INLINE_API int is_tls_ecdh_anon_with_aes_128_cbc_sha_256(dtls_cipher_t cipher)
{
#ifdef DTLS_ECC
return cipher == TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256;
......@@ -511,7 +507,7 @@ static inline int is_tls_ecdh_anon_with_aes_128_cbc_sha_256(dtls_cipher_t cipher
}
/** returns true if the cipher matches TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256 */
static inline int is_tls_ecdhe_psk_with_aes_128_cbc_sha_256(dtls_cipher_t cipher)
INLINE_API int is_tls_ecdhe_psk_with_aes_128_cbc_sha_256(dtls_cipher_t cipher)
{
#if defined(DTLS_ECC) && defined(DTLS_PSK)
return cipher == TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256;
......@@ -523,7 +519,7 @@ static inline int is_tls_ecdhe_psk_with_aes_128_cbc_sha_256(dtls_cipher_t cipher
/** returns true if the application is configured for psk */
static inline int is_psk_supported(dtls_context_t *ctx)
INLINE_API int is_psk_supported(dtls_context_t *ctx)
{
#ifdef DTLS_PSK
return ctx && ctx->h && ctx->h->get_psk_info;
......@@ -533,7 +529,7 @@ static inline int is_psk_supported(dtls_context_t *ctx)
}
/** returns true if the application is configured for ecdhe_ecdsa */
static inline int is_ecdsa_supported(dtls_context_t *ctx, int is_client)
INLINE_API int is_ecdsa_supported(dtls_context_t *ctx, int is_client)
{
#ifdef DTLS_ECC
return ctx && ctx->h && ((!is_client && ctx->h->get_ecdsa_key) ||
......@@ -544,7 +540,7 @@ static inline int is_ecdsa_supported(dtls_context_t *ctx, int is_client)
}
/** returns true if the application is configured for x509 */
static inline int is_x509_supported(dtls_context_t *ctx, int is_client)
INLINE_API int is_x509_supported(dtls_context_t *ctx, int is_client)
{
#ifdef DTLS_X509
return ctx && ctx->h && ((!is_client && ctx->h->get_x509_cert) ||
......@@ -556,7 +552,7 @@ static inline int is_x509_supported(dtls_context_t *ctx, int is_client)
/** Returns true if the application is configured for ecdhe_ecdsa with
* client authentication */
static inline int is_ecdsa_client_auth_supported(dtls_context_t *ctx)
INLINE_API int is_ecdsa_client_auth_supported(dtls_context_t *ctx)
{
#ifdef DTLS_ECC
return ctx && ctx->h && ctx->h->get_ecdsa_key && ctx->h->verify_ecdsa_key;
......@@ -567,7 +563,7 @@ static inline int is_ecdsa_client_auth_supported(dtls_context_t *ctx)
/** Returns true if the application is configured for x509 with
* client authentication */
static inline int is_x509_client_auth_supported(dtls_context_t *ctx)
INLINE_API int is_x509_client_auth_supported(dtls_context_t *ctx)
{
#ifdef DTLS_X509
return ctx && ctx->h && ctx->h->get_x509_cert && ctx->h->verify_x509_cert;
......@@ -577,7 +573,7 @@ static inline int is_x509_client_auth_supported(dtls_context_t *ctx)
}
/** returns true if ecdh_anon_with_aes_128_cbc_sha is supported */
static inline int is_ecdh_anon_supported(dtls_context_t *ctx)
INLINE_API int is_ecdh_anon_supported(dtls_context_t *ctx)
{
#ifdef DTLS_ECC
return ctx && (ctx->is_anon_ecdh_eabled == DTLS_CIPHER_ENABLE);
......@@ -587,7 +583,7 @@ static inline int is_ecdh_anon_supported(dtls_context_t *ctx)
}
/** returns true if ecdhe_psk_with_aes_128_cbc_sha_256 is supported */
static inline int is_ecdhe_psk_supported(dtls_context_t *ctx)
INLINE_API int is_ecdhe_psk_supported(dtls_context_t *ctx)
{
#if defined(DTLS_ECC) && defined(DTLS_PSK)
return is_psk_supported(ctx);
......@@ -1177,7 +1173,7 @@ error:
* Parse the ClientKeyExchange and update the internal handshake state with
* the new data.
*/
static inline int
INLINE_API int
check_client_keyexchange(dtls_context_t *ctx,
dtls_handshake_parameters_t *handshake,
uint8 *data, size_t length) {
......@@ -1293,7 +1289,7 @@ check_client_keyexchange(dtls_context_t *ctx,