Friendly LWM2M client
Lwm2mSecurity.h
Go to the documentation of this file.
1 /*
2  * Lwm2mSecurity
3  * Generated on: 2023-11-02 16:43:32
4  * Created by: Sinai RnD
5  */
6 
7 #ifndef WPP_M_0_LWM2M_SECURITY_H
8 #define WPP_M_0_LWM2M_SECURITY_H
9 
10 #include "Lwm2mSecurityConfig.h"
11 #include "Lwm2mSecurityInfo.h"
12 #include "Instance.h"
13 #include "InstSubject.h"
14 
15 /* --------------- Сode_h block 0 start --------------- */
16 /* --------------- Сode_h block 0 end --------------- */
17 
18 namespace wpp {
19 
20 class WppClient;
21 class Object;
22 
23 /* --------------- Сode_h block 1 start --------------- */
24 /* --------------- Сode_h block 1 end --------------- */
25 
26 class Lwm2mSecurity : public Instance {
27 public:
28  enum ID: ID_T {
35  #if RES_0_6
36  SMS_SECURITY_MODE_6 = 6,
37  #endif
38  #if RES_0_7
39  SMS_BINDING_KEY_PARAMETERS_7 = 7,
40  #endif
41  #if RES_0_8
42  SMS_BINDING_SECRET_KEY_S__8 = 8,
43  #endif
44  #if RES_0_9
45  LWM2M_SERVER_SMS_NUMBER_9 = 9,
46  #endif
47  #if RES_0_10
49  #endif
50  #if RES_0_11
52  #endif
53  #if RES_0_12
55  #endif
56  #if RES_0_13
57  MATCHING_TYPE_13 = 13,
58  #endif
59  #if RES_0_14
60  SNI_14 = 14,
61  #endif
62  #if RES_0_15
63  CERTIFICATE_USAGE_15 = 15,
64  #endif
65  #if RES_0_16
66  DTLS_TLS_CIPHERSUITE_16 = 16,
67  #endif
68  #if RES_0_17
69  OSCORE_SECURITY_MODE_17 = 17,
70  #endif
71  };
72 
73  /* --------------- Code_h block 2 start --------------- */
74  #if RES_0_6
75  enum SmsSecMode: uint8_t {
76  SMS_SEC_MODE_MIN = 0,
77  SMS_SEC_DTLS_PSK = 1,
78  SMS_SEC_PACK_STRUCT = 2,
79  SMS_NO_SEC = 3,
80  SMS_SEC_MODE_MAX = 255
81  };
82  #endif
83 
84  #if RES_0_8
85  enum SmsKeyLen: uint8_t {
86  MIN_SMS_KEY_LEN = 16,
87  MAX_SMS_KEY_LEN = 48
88  };
89  #endif
90 
91  #if RES_0_13
92  enum MatchType: uint8_t {
93  EXACT_MATCH = 0,
94  SHA_256 = 1,
95  SHA_384 = 2,
96  SHA_512 = 3,
97  MAX_MATCH_TYPE
98  };
99  #endif
100 
101  #if RES_0_15
102  enum CertUsage: uint8_t {
103  CA_CONSTRAINT = 0,
104  SERVICE_CERT_CONSTRAINT = 1,
105  TRUST_ANCHOR_ASSERTION = 2,
106  DOMAIN_ISSUED_CERT = 3,
107  MAX_CERT_USAGE
108  };
109  #endif
110  /* --------------- Code_h block 2 end --------------- */
111 
112 public:
113  Lwm2mSecurity(lwm2m_context_t &context, const OBJ_LINK_T &id);
114  ~Lwm2mSecurity();
115 
116  /* --------------- Helpful methods --------------- */
122  static Object & object(WppClient &ctx);
123 
130  static Lwm2mSecurity * instance(WppClient &ctx, ID_T instId = ID_T_MAX_VAL);
131 
138  static Lwm2mSecurity * createInst(WppClient &ctx, ID_T instId = ID_T_MAX_VAL);
139 
146  static bool removeInst(WppClient &ctx, ID_T instId);
147 
148  /* --------------- Code_h block 3 start --------------- */
149  /* --------------- Code_h block 3 end --------------- */
150 
151 protected:
152  /* --------------- Instance implementation part --------------- */
153  /*
154  * Handles information about resource operation that made server
155  */
156  void serverOperationNotifier(Instance *securityInst, ItemOp::TYPE type, const ResLink &resLink) override;
157  /*
158  * Handles information about resource operation that made user
159  */
160  void userOperationNotifier(ItemOp::TYPE type, const ResLink &resLink) override;
161 
162  /* --------------- Code_h block 4 start --------------- */
163  /* --------------- Code_h block 4 end --------------- */
164 
165 private:
166  /* --------------- Class private methods --------------- */
167  /*
168  * Creates resources without initializing.
169  */
170  void resourcesCreate();
171  /*
172  * Initialize resources with default values
173  * SINGLE resource always must have at least one instance.
174  */
175  void resourcesInit();
176 
177  /* --------------- Code_h block 5 start --------------- */
178  /* --------------- Code_h block 5 end --------------- */
179 
180 private:
181  /* --------------- Class private properties --------------- */
182  /* --------------- Code_h block 6 start --------------- */
183  /* --------------- Code_h block 6 end --------------- */
184 };
185 
186 } /* namespace wpp */
187 
188 #endif /* WPP_M_0_LWM2M_SECURITY_H */
#define ID_T_MAX_VAL
Definition: WppTypes.h:16
Instance is interface class that implements manipulation with derived class resources....
Definition: Instance.h:40
Instance(lwm2m_context_t &context, const OBJ_LINK_T &id)
Definition: Instance.h:42
static Object & object(WppClient &ctx)
Gets the Object reference.
Lwm2mSecurity(lwm2m_context_t &context, const OBJ_LINK_T &id)
static Lwm2mSecurity * createInst(WppClient &ctx, ID_T instId=ID_T_MAX_VAL)
Creates an instance of the object.
static Lwm2mSecurity * instance(WppClient &ctx, ID_T instId=ID_T_MAX_VAL)
Gets an instance of the object.
static bool removeInst(WppClient &ctx, ID_T instId)
Removes an instance of the object.
void userOperationNotifier(ItemOp::TYPE type, const ResLink &resLink) override
This method must be implemented by the derived class, and handle information about resource operation...
@ BOOTSTRAP_SERVER_ACCOUNT_TIMEOUT_12
Definition: Lwm2mSecurity.h:54
void serverOperationNotifier(Instance *securityInst, ItemOp::TYPE type, const ResLink &resLink) override
This method must be implemented by the derived class, and handle information about resource operation...
The WppConnection class represents a connection interface for the Wpp library.
Definition: WppClient.cpp:14
uint16_t ID_T
Definition: WppTypes.h:15
TYPE
Enum representing the different types of operations.
Definition: ItemOp.h:29