Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iotivity-lite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
41
Issues
41
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
IoTivity
iotivity-lite
Commits
ff444435
Commit
ff444435
authored
Aug 25, 2020
by
Kishen Maloor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'origin/fargo' into gaborone
Signed-off-by:
Kishen Maloor
<
kishen.maloor@intel.com
>
parents
b4129b95
a211c390
Pipeline
#1073
failed with stage
in 3 minutes and 40 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
120 additions
and
63 deletions
+120
-63
.gitlab-ci.yml
.gitlab-ci.yml
+5
-17
api/oc_collection.c
api/oc_collection.c
+1
-1
api/oc_discovery.c
api/oc_discovery.c
+2
-2
api/oc_introspection.c
api/oc_introspection.c
+1
-1
api/oc_ri.c
api/oc_ri.c
+7
-4
api/oc_server_api.c
api/oc_server_api.c
+12
-14
apps/cloud_certification_tests.c
apps/cloud_certification_tests.c
+14
-1
include/oc_ri.h
include/oc_ri.h
+0
-1
messaging/coap/engine.c
messaging/coap/engine.c
+9
-8
messaging/coap/observe.c
messaging/coap/observe.c
+5
-4
messaging/coap/oc_coap.h
messaging/coap/oc_coap.h
+3
-2
messaging/coap/separate.c
messaging/coap/separate.c
+7
-3
messaging/coap/separate.h
messaging/coap/separate.h
+1
-2
security/oc_tls.c
security/oc_tls.c
+53
-3
No files found.
.gitlab-ci.yml
View file @
ff444435
...
...
@@ -31,26 +31,13 @@ Android_build:
variables
:
GIT_SUBMODULE_STRATEGY
:
normal
stage
:
build
image
:
openjdk:8-jdk
before_script
:
-
apt-get --quiet update --yes
-
apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 make autoconf swig patch
-
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
-
unzip -d android-sdk-linux android-sdk.zip
-
echo y | android-sdk-linux/tools/bin/sdkmanager "ndk-bundle" >/dev/null
-
echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-28" >/dev/null
-
echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
-
echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;28.0.2" >/dev/null
-
export ANDROID_HOME=$PWD/android-sdk-linux
-
export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
# temporarily disable checking for EPIPE error and use yes to accept all licenses
-
set +o pipefail
-
yes | android-sdk-linux/tools/bin/sdkmanager --licenses
-
set -o pipefail
-
./android-sdk-linux/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --api 23 --install-dir ~/android-arm-23
image
:
gitlab.iotivity.org:5050/iotivity/iotivity-lite
script
:
-
cd port/android
-
make DYNAMIC=1 TCP=1 IPV4=1 SECURE=1 PKI=1 CLOUD=1 JAVA=1 DEBUG=0
retry
:
max
:
2
when
:
runner_system_failure
doxygen
:
variables
:
...
...
@@ -62,3 +49,4 @@ doxygen:
-
doxygen --version
-
cd tools
-
./build_doc.sh
api/oc_collection.c
View file @
ff444435
...
...
@@ -979,7 +979,7 @@ oc_handle_collection_request(oc_method_t method, oc_request_t *request,
break
;
}
}
request
->
response
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
size
;
request
->
response
->
response_buffer
->
code
=
code
;
...
...
api/oc_discovery.c
View file @
ff444435
...
...
@@ -492,7 +492,7 @@ oc_core_1_1_discovery_handler(oc_request_t *request,
}
int
response_length
=
oc_rep_get_encoded_payload_size
();
request
->
response
->
content_format
=
APPLICATION_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_CBOR
;
if
(
matches
&&
response_length
)
{
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
response_length
;
...
...
@@ -678,7 +678,7 @@ oc_core_discovery_handler(oc_request_t *request, oc_interface_mask_t iface_mask,
break
;
}
int
response_length
=
oc_rep_get_encoded_payload_size
();
request
->
response
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
if
(
matches
&&
response_length
>
0
)
{
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
response_length
;
...
...
api/oc_introspection.c
View file @
ff444435
...
...
@@ -78,7 +78,7 @@ oc_core_introspection_data_handler(oc_request_t *request,
IDD_size
=
oc_storage_read
(
idd_tag
,
request
->
response
->
response_buffer
->
buffer
,
OC_MAX_APP_DATA_SIZE
);
#endif
/* OC_IDD_API */
request
->
response
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
if
(
IDD_size
>=
0
&&
IDD_size
<
OC_MAX_APP_DATA_SIZE
)
{
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
IDD_size
;
request
->
response
->
response_buffer
->
code
=
oc_status_code
(
OC_STATUS_OK
);
...
...
api/oc_ri.c
View file @
ff444435
...
...
@@ -272,6 +272,8 @@ stop_processes(void)
oc_resource_t
*
oc_ri_get_app_resource_by_uri
(
const
char
*
uri
,
size_t
uri_len
,
size_t
device
)
{
if
(
!
uri
||
uri_len
==
0
)
return
NULL
;
int
skip
=
0
;
if
(
uri
[
0
]
!=
'/'
)
skip
=
1
;
...
...
@@ -685,10 +687,10 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
*/
response_buffer
.
code
=
0
;
response_buffer
.
response_length
=
0
;
response_buffer
.
content_format
=
0
;
response_obj
.
separate_response
=
NULL
;
response_obj
.
response_buffer
=
&
response_buffer
;
response_obj
.
content_format
=
0
;
request_obj
.
response
=
&
response_obj
;
request_obj
.
request_payload
=
NULL
;
...
...
@@ -703,7 +705,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
oc_interface_mask_t
iface_query
=
0
,
iface_mask
=
0
;
/* Obtain request uri from the CoAP packet. */
const
char
*
uri_path
;
const
char
*
uri_path
=
NULL
;
size_t
uri_path_len
=
coap_get_header_uri_path
(
request
,
&
uri_path
);
/* Obtain query string from CoAP packet. */
...
...
@@ -1123,8 +1125,9 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
coap_set_payload
(
response
,
response_buffer
.
buffer
,
response_buffer
.
response_length
);
#endif
/* !OC_BLOCK_WISE */
if
(
response_obj
.
content_format
>
0
)
{
coap_set_header_content_format
(
response
,
response_obj
.
content_format
);
if
(
response_buffer
.
content_format
>
0
)
{
coap_set_header_content_format
(
response
,
response_buffer
.
content_format
);
}
}
...
...
api/oc_server_api.c
View file @
ff444435
...
...
@@ -75,11 +75,12 @@ oc_send_response(oc_request_t *request, oc_status_t response_code)
{
#ifdef OC_SPEC_VER_OIC
if
(
request
->
origin
&&
request
->
origin
->
version
==
OIC_VER_1_1_0
)
{
request
->
response
->
content_format
=
APPLICATION_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_CBOR
;
}
else
#endif
/* OC_SPEC_VER_OIC */
{
request
->
response
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
request
->
response
->
response_buffer
->
content_format
=
APPLICATION_VND_OCF_CBOR
;
}
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
response_length
();
...
...
@@ -237,7 +238,7 @@ oc_send_response_raw(oc_request_t *request, const uint8_t *payload, size_t size,
oc_content_format_t
content_format
,
oc_status_t
response_code
)
{
request
->
response
->
content_format
=
content_format
;
request
->
response
->
response_buffer
->
content_format
=
content_format
;
memcpy
(
request
->
response
->
response_buffer
->
buffer
,
payload
,
size
);
request
->
response
->
response_buffer
->
response_length
=
(
uint16_t
)
size
;
request
->
response
->
response_buffer
->
code
=
oc_status_code
(
response_code
);
...
...
@@ -410,8 +411,10 @@ oc_resource_set_request_handler(oc_resource_t *resource, oc_method_t method,
break
;
}
handler
->
cb
=
callback
;
handler
->
user_data
=
user_data
;
if
(
handler
)
{
handler
->
cb
=
callback
;
handler
->
user_data
=
user_data
;
}
}
void
...
...
@@ -464,26 +467,21 @@ oc_send_separate_response(oc_separate_response_t *handle,
response_buffer
.
buffer
=
handle
->
buffer
;
response_buffer
.
response_length
=
(
uint16_t
)
response_length
();
response_buffer
.
code
=
oc_status_code
(
response_code
);
response_buffer
.
content_format
=
APPLICATION_VND_OCF_CBOR
;
coap_separate_t
*
cur
=
oc_list_head
(
handle
->
requests
),
*
next
=
NULL
;
coap_packet_t
response
[
1
];
while
(
cur
!=
NULL
)
{
next
=
cur
->
next
;
if
(
cur
->
observe
>
0
)
{
if
(
cur
->
observe
<
3
)
{
coap_transaction_t
*
t
=
coap_new_transaction
(
coap_get_mid
(),
&
cur
->
endpoint
);
if
(
t
)
{
coap_separate_resume
(
response
,
cur
,
(
uint8_t
)
oc_status_code
(
response_code
),
t
->
mid
);
#ifdef OC_SPEC_VER_OIC
if
(
cur
->
endpoint
.
version
==
OIC_VER_1_1_0
)
{
coap_set_header_content_format
(
response
,
APPLICATION_CBOR
);
}
else
#endif
/* OC_SPEC_VER_OIC */
{
coap_set_header_content_format
(
response
,
APPLICATION_VND_OCF_CBOR
);
}
coap_set_header_content_format
(
response
,
response_buffer
.
content_format
);
#ifdef OC_BLOCK_WISE
oc_blockwise_state_t
*
response_state
=
NULL
;
...
...
apps/cloud_certification_tests.c
View file @
ff444435
...
...
@@ -90,12 +90,25 @@ display_menu(void)
} \
} while (0)
static
void
set_device_custom_property
(
void
*
data
)
{
(
void
)
data
;
oc_rep_set_array
(
root
,
dmn
);
oc_rep_object_array_begin_item
(
dmn
);
oc_rep_set_text_string
(
dmn
,
language
,
"en"
);
oc_rep_set_text_string
(
dmn
,
value
,
manufacturer
);
oc_rep_object_array_end_item
(
dmn
);
oc_rep_close_array
(
root
,
dmn
);
}
static
int
app_init
(
void
)
{
int
ret
=
oc_init_platform
(
manufacturer
,
NULL
,
NULL
);
ret
|=
oc_add_device
(
"/oic/d"
,
device_rt
,
device_name
,
spec_version
,
data_model_version
,
NULL
,
NULL
);
data_model_version
,
set_device_custom_property
,
NULL
);
if
(
ret
||
!
deviceid
)
{
return
ret
;
}
...
...
include/oc_ri.h
View file @
ff444435
...
...
@@ -101,7 +101,6 @@ typedef struct oc_response_t
{
oc_separate_response_t
*
separate_response
;
oc_response_buffer_t
*
response_buffer
;
oc_content_format_t
content_format
;
}
oc_response_t
;
typedef
enum
{
...
...
messaging/coap/engine.c
View file @
ff444435
...
...
@@ -219,8 +219,9 @@ coap_receive(oc_message_t *msg)
#endif
/* OC_TCP */
{
transaction
=
coap_get_transaction_by_mid
(
message
->
mid
);
if
(
transaction
)
if
(
transaction
)
{
coap_clear_transaction
(
transaction
);
}
transaction
=
NULL
;
}
...
...
@@ -813,13 +814,13 @@ send_message:
}
}
#endif
/* OC_CLIENT && OC_BLOCK_WISE */
transaction
->
message
->
length
=
coap_serialize_message
(
response
,
transaction
->
message
->
data
);
if
(
transaction
->
message
->
length
>
0
)
{
coap_send_transaction
(
transaction
);
}
else
{
coap_clear_transaction
(
transaction
);
}
}
transaction
->
message
->
length
=
coap_serialize_message
(
response
,
transaction
->
message
->
data
);
if
(
transaction
->
message
->
length
>
0
)
{
coap_send_transaction
(
transaction
);
}
else
{
coap_clear_transaction
(
transaction
);
}
}
...
...
messaging/coap/observe.c
View file @
ff444435
...
...
@@ -730,10 +730,11 @@ coap_notify_observers(oc_resource_t *resource,
"notification"
);
#ifdef OC_BLOCK_WISE
if
(
coap_separate_accept
(
req
,
response
.
separate_response
,
&
obs
->
endpoint
,
0
,
obs
->
block2_size
)
==
1
)
&
obs
->
endpoint
,
obs
->
obs_counter
,
obs
->
block2_size
)
==
1
)
#else
/* OC_BLOCK_WISE */
if
(
coap_separate_accept
(
req
,
response
.
separate_response
,
&
obs
->
endpoint
,
0
)
==
1
)
&
obs
->
endpoint
,
obs
->
obs_counter
)
==
1
)
#endif
/* !OC_BLOCK_WISE */
response
.
separate_response
->
active
=
1
;
}
// separate response
...
...
@@ -823,9 +824,9 @@ coap_notify_observers(oc_resource_t *resource,
}
else
{
coap_set_header_observe
(
notification
,
1
);
}
if
(
response
.
content_format
>
0
)
{
if
(
response
_buf
->
content_format
>
0
)
{
coap_set_header_content_format
(
notification
,
response
.
content_format
);
response
_buf
->
content_format
);
}
coap_set_token
(
notification
,
obs
->
token
,
obs
->
token_len
);
transaction
=
coap_new_transaction
(
coap_get_mid
(),
&
obs
->
endpoint
);
...
...
messaging/coap/oc_coap.h
View file @
ff444435
...
...
@@ -19,10 +19,10 @@
#include "separate.h"
#include "util/oc_list.h"
#include "oc_ri.h"
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
struct
oc_separate_response_s
...
...
@@ -42,6 +42,7 @@ struct oc_response_buffer_s
uint16_t
buffer_size
;
uint16_t
response_length
;
int
code
;
oc_content_format_t
content_format
;
};
#ifdef __cplusplus
...
...
messaging/coap/separate.c
View file @
ff444435
...
...
@@ -98,7 +98,8 @@ coap_separate_accept(void *request, oc_separate_response_t *separate_response,
separate_store
!=
NULL
;
separate_store
=
separate_store
->
next
)
{
if
(
separate_store
->
token_len
==
coap_req
->
token_len
&&
memcmp
(
separate_store
->
token
,
coap_req
->
token
,
separate_store
->
token_len
)
==
0
)
{
separate_store
->
token_len
)
==
0
&&
separate_store
->
observe
==
observe
)
{
break
;
}
}
...
...
@@ -113,8 +114,6 @@ coap_separate_accept(void *request, oc_separate_response_t *separate_response,
oc_list_add
(
separate_response
->
requests
,
separate_store
);
memcpy
(
&
separate_store
->
endpoint
,
endpoint
,
sizeof
(
oc_endpoint_t
));
/* store correct response type */
separate_store
->
type
=
COAP_TYPE_NON
;
...
...
@@ -131,6 +130,8 @@ coap_separate_accept(void *request, oc_separate_response_t *separate_response,
#endif
/* OC_BLOCK_WISE */
}
memcpy
(
&
separate_store
->
endpoint
,
endpoint
,
sizeof
(
oc_endpoint_t
));
separate_store
->
observe
=
observe
;
/* send separate ACK for CON */
...
...
@@ -179,6 +180,9 @@ coap_separate_resume(void *response, coap_separate_t *separate_store,
if
(
separate_store
->
token_len
)
{
coap_set_token
(
response
,
separate_store
->
token
,
separate_store
->
token_len
);
}
if
(
separate_store
->
observe
==
0
)
{
coap_set_header_observe
(
response
,
0
);
}
}
/*---------------------------------------------------------------------------*/
void
...
...
messaging/coap/separate.h
View file @
ff444435
...
...
@@ -54,8 +54,7 @@
#include "transactions.h"
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
typedef
struct
coap_separate
...
...
security/oc_tls.c
View file @
ff444435
...
...
@@ -39,6 +39,7 @@
#include "api/oc_main.h"
#include "api/oc_session_events_internal.h"
#include "messaging/coap/observe.h"
#include "messaging/coap/engine.h"
#include "oc_acl_internal.h"
#include "oc_api.h"
#include "oc_buffer.h"
...
...
@@ -261,6 +262,35 @@ is_peer_active(oc_tls_peer_t *peer)
static
oc_event_callback_retval_t
oc_tls_inactive
(
void
*
data
);
#ifdef OC_CLIENT
static
void
oc_tls_free_invalid_peer
(
oc_tls_peer_t
*
peer
)
{
OC_DBG
(
"
\n
oc_tls: removing invalid peer"
);
oc_list_remove
(
tls_peers
,
peer
);
oc_ri_remove_timed_event_callback
(
peer
,
oc_tls_inactive
);
mbedtls_ssl_free
(
&
peer
->
ssl_ctx
);
oc_message_t
*
message
=
(
oc_message_t
*
)
oc_list_pop
(
peer
->
send_q
);
while
(
message
!=
NULL
)
{
oc_message_unref
(
message
);
message
=
(
oc_message_t
*
)
oc_list_pop
(
peer
->
send_q
);
}
message
=
(
oc_message_t
*
)
oc_list_pop
(
peer
->
recv_q
);
while
(
message
!=
NULL
)
{
oc_message_unref
(
message
);
message
=
(
oc_message_t
*
)
oc_list_pop
(
peer
->
recv_q
);
}
#ifdef OC_PKI
oc_free_string
(
&
peer
->
public_key
);
#endif
/* OC_PKI */
mbedtls_ssl_config_free
(
&
peer
->
ssl_conf
);
oc_etimer_stop
(
&
peer
->
timer
.
fin_timer
);
oc_memb_free
(
&
tls_peers_s
,
peer
);
}
#endif
/* OC_CLIENT */
static
void
oc_tls_free_peer
(
oc_tls_peer_t
*
peer
,
bool
inactivity_cb
)
{
...
...
@@ -1622,8 +1652,23 @@ write_application_data(oc_tls_peer_t *peer)
static
void
oc_tls_init_connection
(
oc_message_t
*
message
)
{
oc_tls_peer_t
*
peer
=
oc_tls_add_peer
(
&
message
->
endpoint
,
MBEDTLS_SSL_IS_CLIENT
);
oc_sec_pstat_t
*
pstat
=
oc_sec_get_pstat
(
message
->
endpoint
.
device
);
if
(
pstat
->
s
!=
OC_DOS_RFNOP
)
{
oc_message_unref
(
message
);
return
;
}
oc_tls_peer_t
*
peer
=
oc_tls_get_peer
(
&
message
->
endpoint
);
if
(
peer
&&
peer
->
role
!=
MBEDTLS_SSL_IS_CLIENT
)
{
oc_tls_free_invalid_peer
(
peer
);
peer
=
NULL
;
}
if
(
!
peer
)
{
peer
=
oc_tls_add_peer
(
&
message
->
endpoint
,
MBEDTLS_SSL_IS_CLIENT
);
}
if
(
peer
)
{
oc_message_t
*
duplicate
=
oc_list_head
(
peer
->
send_q
);
while
(
duplicate
!=
NULL
)
{
...
...
@@ -1806,7 +1851,10 @@ read_application_data(oc_tls_peer_t *peer)
}
message
->
length
=
ret
;
message
->
encrypted
=
0
;
oc_recv_message
(
message
);
if
(
oc_process_post
(
&
coap_engine
,
oc_events
[
INBOUND_RI_EVENT
],
message
)
==
OC_PROCESS_ERR_FULL
)
{
oc_message_unref
(
message
);
}
OC_DBG
(
"oc_tls: Decrypted incoming message"
);
}
}
...
...
@@ -1828,6 +1876,8 @@ oc_tls_recv_message(oc_message_t *message)
oc_list_add
(
peer
->
recv_q
,
message
);
peer
->
timestamp
=
oc_clock_time
();
oc_tls_handler_schedule_read
(
peer
);
}
else
{
oc_message_unref
(
message
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment