ndn-lite
access-control.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Tianyuan Yu, Zhiyi Zhang
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v3.0. See the file LICENSE in the top level
6  * directory for more details.
7  *
8  * See AUTHORS.md for complete list of NDN IOT PKG authors and contributors.
9  */
10 
11 #ifndef NDN_APP_SUPPORT_ACCESS_CONTROL_H
12 #define NDN_APP_SUPPORT_ACCESS_CONTROL_H
13 
14 #include "../encode/interest.h"
15 #include "../encode/data.h"
16 
22 typedef struct ndn_ac_unfinished_key {
26  uint32_t key_id;
36 
40 typedef struct ndn_ac_state {
62 
69 void
70 ndn_ac_state_init(const ndn_name_t* self_identity, const ndn_ecc_pub_t* self_pub_key,
71  const ndn_ecc_prv_t* self_prv_key);
72 
83 int
85  const ndn_name_t* home_prefix,
86  const name_component_t* self_identity,
87  uint32_t ac_key_id, const ndn_ecc_prv_t* prv_key,
88  uint8_t is_ek);
89 
96 int
98 
105 int
107 
108 /*************************/
109 /* APIs for Controller */
110 /*************************/
111 
119 int
120 ndn_ac_on_interest_process(ndn_data_t* response, const ndn_interest_t* interest);
121 
122 /*************************************/
123 /* Helper Functions for Controller */
124 /*************************************/
125 int
127  ndn_data_t* response);
128 
129 int
131  ndn_data_t* response);
132 
133 
134 #endif // NDN_APP_SUPPORT_ACCESS_CONTROL_H
#define NDN_APPSUPPORT_AC_KEY_LIST_SIZE
Definition: ndn-constants.h:62
The structure to represent an NDN Interest packet.
Definition: interest.h:31
uint32_t eks[NDN_APPSUPPORT_AC_KEY_LIST_SIZE]
The AES key id list in Encryption Request.
Definition: access-control.h:56
The structure to keep the state when doing NDN TLV decoding.
Definition: decoder.h:21
uint32_t dks[NDN_APPSUPPORT_AC_KEY_LIST_SIZE]
The AES key id list in Decryption Request.
Definition: access-control.h:60
int ndn_ac_on_dk_response_process(const ndn_data_t *data)
Process Deryption Request's Response.
Definition: access-control.c:152
The structure to represent an NDN Data packet The best practice of using ndn_data_t is to first decla...
Definition: data.h:30
int ndn_ac_prepare_dk_response(ndn_decoder_t *decoder, const ndn_interest_t *interest, ndn_data_t *response)
Definition: access-control.c:324
The structure to keep an ECC private key.
Definition: ndn-lite-ecc.h:86
struct ndn_ac_unfinished_key ndn_ac_unfinished_key_t
The structure to present an unfinished key only used in Access Control EK/DK process.
uint32_t key_id
The key id of unfinished key.
Definition: access-control.h:26
The structure to represent the Name.
Definition: name.h:24
ndn_name_t self_identity
The identity of local state manager.
Definition: access-control.h:44
int ndn_ac_prepare_ek_response(ndn_decoder_t *decoder, const ndn_interest_t *interest, ndn_data_t *response)
Definition: access-control.c:239
ndn_ecc_prv_t self_prv_key
The identity ECC private key.
Definition: access-control.h:52
The structure to present an unfinished key only used in Access Control EK/DK process.
Definition: access-control.h:22
ndn_ecc_prv_t dh_prv
The locally generated ECC private key.
Definition: access-control.h:34
struct ndn_ac_state ndn_ac_state_t
The structure to implement state storage and management in Access Control.
The structure to represent the Name Component.
Definition: name-component.h:23
ndn_ecc_pub_t self_pub_key
The identity ECC public key.
Definition: access-control.h:48
The structure to keep the state when doing NDN TLV encoding.
Definition: encoder.h:31
The structure to implement state storage and management in Access Control.
Definition: access-control.h:40
int ndn_ac_on_ek_response_process(const ndn_data_t *data)
Process Encryption Request's Response.
Definition: access-control.c:99
int ndn_ac_on_interest_process(ndn_data_t *response, const ndn_interest_t *interest)
Process Access Control Request.
Definition: access-control.c:218
ndn_ecc_pub_t dh_pub
The locally generated ECC public key.
Definition: access-control.h:30
int ndn_ac_prepare_key_request_interest(ndn_encoder_t *encoder, const ndn_name_t *home_prefix, const name_component_t *self_identity, uint32_t ac_key_id, const ndn_ecc_prv_t *prv_key, uint8_t is_ek)
Prepare a Key Request to send.
Definition: access-control.c:40
The structure to keep an ECC public key.
Definition: ndn-lite-ecc.h:71
void ndn_ac_state_init(const ndn_name_t *self_identity, const ndn_ecc_pub_t *self_pub_key, const ndn_ecc_prv_t *self_prv_key)
Init a Access Control State structure.
Definition: access-control.c:23