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
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
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
ffc8f5a3
Commit
ffc8f5a3
authored
Apr 20, 2019
by
Gerrit Code Review
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Merge remote branch 'origin/master' into swig" into swig
parents
a1d1f1b3
75c52365
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
115 additions
and
95 deletions
+115
-95
api/oc_clock.c
api/oc_clock.c
+4
-2
include/oc_obt.h
include/oc_obt.h
+24
-1
include/oc_pki.h
include/oc_pki.h
+7
-2
onboarding_tool/obtmain.c
onboarding_tool/obtmain.c
+1
-1
port/windows/clock.c
port/windows/clock.c
+18
-10
port/windows/vs2015/IoTivity-Constrained.vcxproj
port/windows/vs2015/IoTivity-Constrained.vcxproj
+8
-0
port/windows/vs2015/IoTivity-Constrained.vcxproj.filters
port/windows/vs2015/IoTivity-Constrained.vcxproj.filters
+27
-0
security/oc_acl.h
security/oc_acl.h
+5
-24
security/oc_obt.c
security/oc_obt.c
+2
-2
security/oc_sp.h
security/oc_sp.h
+1
-7
swig/java_lang/build_swig.sh
swig/java_lang/build_swig.sh
+0
-2
swig/swig_interfaces/oc_acl.i
swig/swig_interfaces/oc_acl.i
+0
-36
swig/swig_interfaces/oc_obt.i
swig/swig_interfaces/oc_obt.i
+18
-2
swig/swig_interfaces/oc_pki.i
swig/swig_interfaces/oc_pki.i
+0
-6
No files found.
api/oc_clock.c
View file @
ffc8f5a3
...
...
@@ -18,6 +18,8 @@
#include "c-timestamp/timestamp.h"
#include "port/oc_log.h"
#define OC_NSEC_PER_SEC 1000000000
size_t
oc_clock_time_rfc3339
(
char
*
out_buf
,
size_t
out_buf_len
)
{
...
...
@@ -31,7 +33,7 @@ oc_clock_encode_time_rfc3339(oc_clock_time_t time, char *out_buf,
timestamp_t
now_t
=
{
0
};
now_t
.
sec
=
(
int64_t
)(
time
/
OC_CLOCK_SECOND
);
now_t
.
nsec
=
(
int32_t
)((
time
%
OC_CLOCK_SECOND
)
*
(
1.e09
/
OC_CLOCK_SECOND
));
now_t
.
nsec
=
(
int32_t
)((
time
%
OC_CLOCK_SECOND
)
*
(
OC_NSEC_PER_SEC
/
OC_CLOCK_SECOND
));
return
timestamp_format
(
out_buf
,
out_buf_len
,
&
now_t
);
}
...
...
@@ -49,7 +51,7 @@ oc_clock_parse_time_rfc3339(const char *in_buf, size_t in_buf_len)
}
oc_clock_time_t
t
=
((
in_time
.
sec
*
1.e09
)
+
in_time
.
nsec
)
*
OC_CLOCK_SECOND
/
1.e09
;
((
in_time
.
sec
*
OC_NSEC_PER_SEC
)
+
in_time
.
nsec
)
*
OC_CLOCK_SECOND
/
OC_NSEC_PER_SEC
;
return
t
;
}
include/oc_obt.h
View file @
ffc8f5a3
...
...
@@ -21,13 +21,36 @@
#include "oc_api.h"
#include "oc_uuid.h"
#include "security/oc_acl.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
oc_ace_res_s
oc_ace_res_t
;
typedef
struct
oc_sec_ace_s
oc_sec_ace_t
;
typedef
enum
{
OC_CONN_AUTH_CRYPT
=
0
,
OC_CONN_ANON_CLEAR
}
oc_ace_connection_type_t
;
typedef
enum
{
OC_ACE_NO_WC
=
-
1
,
OC_ACE_WC_ALL
=
0x111
,
OC_ACE_WC_ALL_SECURED
=
0x01
,
OC_ACE_WC_ALL_PUBLIC
=
0x10
,
}
oc_ace_wildcard_t
;
typedef
enum
{
OC_PERM_NONE
=
0
,
OC_PERM_CREATE
=
(
1
<<
0
),
OC_PERM_RETRIEVE
=
(
1
<<
1
),
OC_PERM_UPDATE
=
(
1
<<
2
),
OC_PERM_DELETE
=
(
1
<<
3
),
OC_PERM_NOTIFY
=
(
1
<<
4
)
}
oc_ace_permissions_t
;
typedef
void
(
*
oc_obt_discovery_cb_t
)(
oc_uuid_t
*
,
oc_endpoint_t
*
,
void
*
);
typedef
void
(
*
oc_obt_device_status_cb_t
)(
oc_uuid_t
*
,
int
,
void
*
);
typedef
void
(
*
oc_obt_status_cb_t
)(
int
,
void
*
);
...
...
include/oc_pki.h
View file @
ffc8f5a3
...
...
@@ -17,12 +17,17 @@
#ifndef OC_PKI_H
#define OC_PKI_H
#include "security/oc_sp.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
enum
{
OC_SP_BASELINE
=
1
<<
1
,
OC_SP_BLACK
=
1
<<
2
,
OC_SP_BLUE
=
1
<<
3
,
OC_SP_PURPLE
=
1
<<
4
}
oc_sp_types_t
;
int
oc_pki_add_mfg_cert
(
size_t
device
,
const
unsigned
char
*
cert
,
size_t
cert_size
,
const
unsigned
char
*
key
,
size_t
key_size
);
...
...
onboarding_tool/obtmain.c
View file @
ffc8f5a3
...
...
@@ -415,7 +415,7 @@ otm_just_works_cb(oc_uuid_t *uuid, int status, void *data)
if
(
status
>=
0
)
{
PRINT
(
"
\n
Successfully performed OTM on device %s
\n
"
,
di
);
add_device_to_list
(
uuid
,
un
owned_devices
);
add_device_to_list
(
uuid
,
owned_devices
);
}
else
{
PRINT
(
"
\n
ERROR performing ownership transfer on device %s
\n
"
,
di
);
}
...
...
port/windows/clock.c
View file @
ffc8f5a3
...
...
@@ -20,24 +20,32 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static
LARGE_INTEGER
frequency
=
{
0
};
void
oc_clock_init
(
void
)
{
QueryPerformanceFrequency
(
&
frequency
);
}
oc_clock_time_t
oc_clock_time
(
void
)
{
LARGE_INTEGER
count
=
{
0
};
if
(
frequency
.
QuadPart
&&
QueryPerformanceCounter
(
&
count
))
{
oc_clock_time_t
t
=
1000
*
count
.
QuadPart
/
frequency
.
QuadPart
;
// milliseconds
return
t
;
}
// fall back if no QueryPerformanceCounter available
return
GetTickCount64
();
oc_clock_time_t
time
=
0
;
// This magic number is the number of 100 nanosecond intervals since January
// 1, 1601 (UTC)
// until 00:00:00 January 1, 1970
static
const
uint64_t
EPOCH
=
((
uint64_t
)
116444736000000000ULL
);
SYSTEMTIME
system_time
;
FILETIME
file_time
;
GetSystemTime
(
&
system_time
);
SystemTimeToFileTime
(
&
system_time
,
&
file_time
);
time
=
((
uint64_t
)
file_time
.
dwLowDateTime
);
time
+=
((
uint64_t
)
file_time
.
dwHighDateTime
)
<<
32
;
time
=
(
oc_clock_time_t
)((
time
-
EPOCH
)
/
10000L
);
return
time
;
}
unsigned
long
...
...
port/windows/vs2015/IoTivity-Constrained.vcxproj
View file @
ffc8f5a3
...
...
@@ -211,7 +211,9 @@
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude
Include=
"..\..\..\api\c-timestamp\timestamp.h"
/>
<ClInclude
Include=
"..\..\..\api\oc_events.h"
/>
<ClInclude
Include=
"..\..\..\api\oc_main.h"
/>
<ClInclude
Include=
"..\..\..\deps\tinycbor\src\cbor.h"
/>
<ClInclude
Include=
"..\..\..\deps\tinycbor\src\cborjson.h"
/>
<ClInclude
Include=
"..\..\..\include\oc_api.h"
/>
...
...
@@ -279,10 +281,16 @@
<ClInclude
Include=
"..\oc_config.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_compare.c"
/>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_format.c"
/>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_parse.c"
/>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_tm.c"
/>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_valid.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_base64.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_blockwise.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_buffer.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_client_api.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_clock.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_collection.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_core_res.c"
/>
<ClCompile
Include=
"..\..\..\api\oc_discovery.c"
/>
...
...
port/windows/vs2015/IoTivity-Constrained.vcxproj.filters
View file @
ffc8f5a3
...
...
@@ -364,6 +364,24 @@
<ClCompile
Include=
"..\..\..\security\oc_obt_otm_randompin.c"
>
<Filter>
Security
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\oc_clock.c"
>
<Filter>
Core
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_compare.c"
>
<Filter>
Core\c-timestamp
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_format.c"
>
<Filter>
Core\c-timestamp
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_parse.c"
>
<Filter>
Core\c-timestamp
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_tm.c"
>
<Filter>
Core\c-timestamp
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\..\api\c-timestamp\timestamp_valid.c"
>
<Filter>
Core\c-timestamp
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"..\..\..\deps\tinycbor\src\cbor.h"
>
...
...
@@ -555,6 +573,9 @@
<ClInclude
Include=
"..\..\..\security\oc_csr.h"
>
<Filter>
Security
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\..\api\oc_main.h"
>
<Filter>
Core
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\..\include\oc_clock_util.h"
>
<Filter>
Headers
</Filter>
</ClInclude>
...
...
@@ -564,6 +585,9 @@
<ClInclude
Include=
"..\..\..\include\oc_signal_event_loop.h"
>
<Filter>
Headers
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\..\api\c-timestamp\timestamp.h"
>
<Filter>
Core\c-timestamp
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter
Include=
"mbedTLS"
>
...
...
@@ -584,6 +608,9 @@
<Filter
Include=
"Security"
>
<UniqueIdentifier>
{c6a27107-4b6c-4673-be9e-c0d8641f0a90}
</UniqueIdentifier>
</Filter>
<Filter
Include=
"Core\c-timestamp"
>
<UniqueIdentifier>
{d83c9727-1931-4e51-9774-da03809c6325}
</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None
Include=
"..\..\..\security\oc_pstat.c.diff"
>
...
...
security/oc_acl.h
View file @
ffc8f5a3
...
...
@@ -17,6 +17,7 @@
#ifndef OC_ACL_H
#define OC_ACL_H
#include "oc_obt.h"
#include "oc_ri.h"
#include "oc_uuid.h"
#include "port/oc_log.h"
...
...
@@ -29,41 +30,21 @@ extern "C"
{
#endif
typedef
enum
{
OC_PERM_NONE
=
0
,
OC_PERM_CREATE
=
(
1
<<
0
),
OC_PERM_RETRIEVE
=
(
1
<<
1
),
OC_PERM_UPDATE
=
(
1
<<
2
),
OC_PERM_DELETE
=
(
1
<<
3
),
OC_PERM_NOTIFY
=
(
1
<<
4
)
}
oc_ace_permissions_t
;
typedef
enum
{
OC_ACE_NO_WC
=
-
1
,
OC_ACE_WC_ALL
=
0x111
,
OC_ACE_WC_ALL_SECURED
=
0x01
,
OC_ACE_WC_ALL_PUBLIC
=
0x10
,
}
oc_ace_wildcard_t
;
typedef
enum
{
OC_SUBJECT_UUID
=
0
,
OC_SUBJECT_ROLE
,
OC_SUBJECT_CONN
}
oc_ace_subject_type_t
;
typedef
enum
{
OC_CONN_AUTH_CRYPT
=
0
,
OC_CONN_ANON_CLEAR
}
oc_ace_connection_type_t
;
typedef
struct
oc_ace_res_s
struct
oc_ace_res_s
{
struct
oc_ace_res_s
*
next
;
oc_string_t
href
;
oc_interface_mask_t
interfaces
;
oc_string_array_t
types
;
oc_ace_wildcard_t
wildcard
;
}
oc_ace_res_t
;
};
typedef
union
{
...
...
@@ -76,7 +57,7 @@ typedef union
oc_ace_connection_type_t
conn
;
}
oc_ace_subject_t
;
typedef
struct
oc_sec_ace_s
struct
oc_sec_ace_s
{
struct
oc_sec_ace_s
*
next
;
OC_LIST_STRUCT
(
resources
);
...
...
@@ -85,7 +66,7 @@ typedef struct oc_sec_ace_s
int
aceid
;
oc_ace_permissions_t
permission
;
// TODO: Add "validity" for ACE. It is currently not a mandatory property
}
oc_sec_ace_t
;
};
typedef
struct
{
...
...
security/oc_obt.c
View file @
ffc8f5a3
...
...
@@ -429,8 +429,6 @@ get_endpoints(oc_client_response_t *data)
return
;
}
cb
->
cb
(
&
device
->
uuid
,
device
->
endpoint
,
cb
->
data
);
oc_remove_delayed_callback
(
cb
,
free_discovery_cb
);
free_discovery_cb
(
cb
);
}
static
void
...
...
@@ -1286,7 +1284,9 @@ oc_obt_init(void)
memcpy
(
doxm
->
devowneruuid
.
id
,
uuid
->
id
,
16
);
memcpy
(
doxm
->
deviceuuid
.
id
,
uuid
->
id
,
16
);
memcpy
(
doxm
->
rowneruuid
.
id
,
uuid
->
id
,
16
);
doxm
->
owned
=
true
;
doxm
->
oxmsel
=
0
;
memcpy
(
creds
->
rowneruuid
.
id
,
uuid
->
id
,
16
);
...
...
security/oc_sp.h
View file @
ffc8f5a3
...
...
@@ -18,18 +18,12 @@
#define OC_SP_H
#include "oc_ri.h"
#include "oc_pki.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
enum
{
OC_SP_BASELINE
=
1
<<
1
,
OC_SP_BLACK
=
1
<<
2
,
OC_SP_BLUE
=
1
<<
3
,
OC_SP_PURPLE
=
1
<<
4
}
oc_sp_types_t
;
typedef
struct
{
oc_sp_types_t
supported_profiles
;
...
...
swig/java_lang/build_swig.sh
View file @
ffc8f5a3
...
...
@@ -38,8 +38,6 @@ fi
#swig -java -package org.iotivity -outdir ../iotivity-lite-java/src/org/iotivity/ -o ../iotivity-lite-java/jni/oc_ri_wrap.c ../swig_interfaces/oc_ri.i
swig
-java
-package
org.iotivity
-outdir
../iotivity-lite-java/src/org/iotivity/
-I
../../port/
-o
../iotivity-lite-java/jni/oc_storage_wrap.c ../swig_interfaces/oc_storage.i
#swig -java -package org.iotivity -outdir ../iotivity-lite-java/src/org/iotivity/ -I../../security/ -o ../iotivity-lite-java/jni/oc_acl_wrap.c ../swig_interfaces/oc_acl.i
cp
*
.h ../iotivity-lite-java/jni/
cp
../oc_java/
*
.java ../iotivity-lite-java/src/org/iotivity/
mkdir
-p
../iotivity-lite-java/src/org/iotivity/oc/
...
...
swig/swig_interfaces/oc_acl.i
deleted
100644 → 0
View file @
a1d1f1b3
/* File oc_acl.i */
%
module
OCAcl
%
{
#
include
"security/oc_acl.h"
%
}
%
ignore
oc_ace_permissions_t
;
%
rename
(
OCAceWildcard
)
oc_ace_wildcard_t
;
%
ignore
oc_ace_subject_type_t
;
%
rename
(
OCAceConnectionType
)
oc_ace_connection_type_t
;
%
rename
(
OCAceResource
)
oc_ace_res_s
;
%
ignore
oc_ace_subject_t
;
%
ignore
oc_ace_subject_t_role
;
%
ignore
oc_sec_ace_s
::
OC_LIST_STRUCT
(
resources
)
;
%
ignore
oc_sec_ace_s
::
subject_type
;
%
ignore
oc_sec_ace_s
::
subject
;
%
ignore
oc_sec_ace_s
::
permission
;
%
rename
(
OCSecurityAce
)
oc_sec_ace_s
;
%
ignore
oc_sec_acl_t
;
%
ignore
oc_sec_acl_init
;
%
ignore
oc_sec_acl_free
;
%
ignore
oc_sec_get_acl
;
%
ignore
oc_sec_acl_default
;
%
ignore
oc_sec_encode_acl
;
%
ignore
oc_sec_decode_acl
;
%
ignore
oc_sec_acl_init
;
%
ignore
post_acl
;
%
ignore
get_acl
;
%
ignore
delete_acl
;
%
ignore
oc_sec_check_acl
;
%
ignore
oc_sec_set_post_otm_acl
;
// TODO solve why the -I is not working for oc_acl.h here
%
include
"../../security/oc_acl.h"
swig/swig_interfaces/oc_obt.i
View file @
ffc8f5a3
...
...
@@ -4,8 +4,6 @@
%
include
"iotivity.swg"
%
import
"oc_uuid.i"
// include not importe oc_acl.i it only exposes structs and enums so no need to build it separate.
%
include
"oc_acl.i"
%
pragma
(
java
)
jniclasscode
=%
{
static
{
...
...
@@ -30,6 +28,24 @@
JCALL1
(
GetJavaVM
,
jenv
,
&
jvm);
}
%
rename
(
OCSecurityAce
)
oc_sec_ace_s
;
/* We are relying on the iotivity-lite library to create and destry instances of oc_sec_ace_s */
%
nodefaultctor
oc_sec_ace_s
;
%
nodefaultdtor
oc_sec_ace_s
;
/* This will cause SWIG to wrap oc_sec_ace_s, even though oc_obt does not know anything about what is inside it */
struct
oc_sec_ace_s{
}
;
%
rename
(
OCAceResource
)
oc_ace_res_s
;
/* We are relying on the iotivity-lite library to create and destry instances of oc_ace_res_s */
%
nodefaultctor
oc_ace_res_s
;
%
nodefaultdtor
oc_ace_res_s
;
/* This will cause SWIG to wrap oc_ace_res_s, even though oc_obt does not know anything about what is inside it */
struct
oc_ace_res_s{
}
;
%
rename
(
OCAceConnectionType
)
oc_ace_connection_type_t
;
%
rename
(
OCAceWildcard
)
oc_ace_wildcard_t
;
%
ignore
oc_ace_permissions_t
;
%
ignore
oc_obt_init
;
%
rename
(
init
)
jni_obt_init
;
%
inline
%
{
...
...
swig/swig_interfaces/oc_pki.i
View file @
ffc8f5a3
...
...
@@ -23,12 +23,6 @@
%
}
%
rename
(
OCSpTypesMask
)
oc_sp_types_t
;
typedef
enum
{
OC_SP_BASELINE
=
1
<<
1
,
OC_SP_BLACK
=
1
<<
2
,
OC_SP_BLUE
=
1
<<
3
,
OC_SP_PURPLE
=
1
<<
4
}
oc_sp_types_t
;
%
apply
(
const
unsigned
char
*
BYTE
,
size_t
LENGTH
)
{
(
const
unsigned
char
*
cert
,
size_t
cert_size
)
}
;
%
apply
(
const
unsigned
char
*
BYTE
,
size_t
LENGTH
)
{
(
const
unsigned
char
*
key
,
size_t
key_size
)
}
;
...
...
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