Skip to content

Commit 40862fb

Browse files
romanmichalvasko
authored andcommitted
session_p UPDATE change enum typedefs to just enum
1 parent 713ecfe commit 40862fb

11 files changed

Lines changed: 140 additions & 140 deletions

src/server_config.c

Lines changed: 64 additions & 64 deletions
Large diffs are not rendered by default.

src/server_config_ks.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ nc_server_config_ks_del_asymmetric_key(struct nc_asymmetric_key *key)
162162
}
163163

164164
static int
165-
nc_server_config_ks_asymmetric_keys(const struct lyd_node *node, NC_OPERATION op)
165+
nc_server_config_ks_asymmetric_keys(const struct lyd_node *node, enum nc_operation op)
166166
{
167167
struct nc_keystore *ks = &server_opts.keystore;
168168
uint16_t i, asym_key_count;
@@ -180,7 +180,7 @@ nc_server_config_ks_asymmetric_keys(const struct lyd_node *node, NC_OPERATION op
180180
}
181181

182182
int
183-
nc_server_config_ks_keystore(const struct lyd_node *node, NC_OPERATION op)
183+
nc_server_config_ks_keystore(const struct lyd_node *node, enum nc_operation op)
184184
{
185185
(void) node;
186186

@@ -203,7 +203,7 @@ nc_server_config_ks_create_asymmetric_key(const struct lyd_node *node)
203203
}
204204

205205
static int
206-
nc_server_config_ks_asymmetric_key(const struct lyd_node *node, NC_OPERATION op)
206+
nc_server_config_ks_asymmetric_key(const struct lyd_node *node, enum nc_operation op)
207207
{
208208
int ret = 0;
209209
struct nc_asymmetric_key *key;
@@ -226,7 +226,7 @@ nc_server_config_ks_asymmetric_key(const struct lyd_node *node, NC_OPERATION op)
226226
}
227227

228228
static int
229-
nc_server_config_ks_public_key_format(const struct lyd_node *node, NC_OPERATION op)
229+
nc_server_config_ks_public_key_format(const struct lyd_node *node, enum nc_operation op)
230230
{
231231
struct nc_asymmetric_key *key;
232232
const char *format;
@@ -252,7 +252,7 @@ nc_server_config_ks_public_key_format(const struct lyd_node *node, NC_OPERATION
252252
}
253253

254254
static int
255-
nc_server_config_ks_public_key(const struct lyd_node *node, NC_OPERATION op)
255+
nc_server_config_ks_public_key(const struct lyd_node *node, enum nc_operation op)
256256
{
257257
struct nc_asymmetric_key *key;
258258

@@ -273,11 +273,11 @@ nc_server_config_ks_public_key(const struct lyd_node *node, NC_OPERATION op)
273273
}
274274

275275
static int
276-
nc_server_config_ks_private_key_format(const struct lyd_node *node, NC_OPERATION op)
276+
nc_server_config_ks_private_key_format(const struct lyd_node *node, enum nc_operation op)
277277
{
278278
struct nc_asymmetric_key *key;
279279
const char *format;
280-
NC_PRIVKEY_FORMAT privkey_type;
280+
enum nc_privkey_format privkey_type;
281281

282282
(void) op;
283283

@@ -302,7 +302,7 @@ nc_server_config_ks_private_key_format(const struct lyd_node *node, NC_OPERATION
302302
}
303303

304304
static int
305-
nc_server_config_ks_cleartext_private_key(const struct lyd_node *node, NC_OPERATION op)
305+
nc_server_config_ks_cleartext_private_key(const struct lyd_node *node, enum nc_operation op)
306306
{
307307
struct nc_asymmetric_key *key;
308308

@@ -335,7 +335,7 @@ nc_server_config_ks_create_certificate(const struct lyd_node *node, struct nc_as
335335
}
336336

337337
static int
338-
nc_server_config_ks_certificate(const struct lyd_node *node, NC_OPERATION op)
338+
nc_server_config_ks_certificate(const struct lyd_node *node, enum nc_operation op)
339339
{
340340
int ret = 0;
341341
struct nc_asymmetric_key *key;
@@ -364,7 +364,7 @@ nc_server_config_ks_certificate(const struct lyd_node *node, NC_OPERATION op)
364364
}
365365

366366
static int
367-
nc_server_config_ks_cert_data(const struct lyd_node *node, NC_OPERATION op)
367+
nc_server_config_ks_cert_data(const struct lyd_node *node, enum nc_operation op)
368368
{
369369
struct nc_certificate *cert;
370370

@@ -385,7 +385,7 @@ nc_server_config_ks_cert_data(const struct lyd_node *node, NC_OPERATION op)
385385
}
386386

387387
int
388-
nc_server_config_parse_keystore(const struct lyd_node *node, NC_OPERATION op)
388+
nc_server_config_parse_keystore(const struct lyd_node *node, enum nc_operation op)
389389
{
390390
const char *name = LYD_NAME(node);
391391
int ret = 0;
@@ -419,7 +419,7 @@ nc_server_config_parse_keystore(const struct lyd_node *node, NC_OPERATION op)
419419
}
420420

421421
int
422-
nc_server_config_fill_keystore(const struct lyd_node *data, NC_OPERATION op)
422+
nc_server_config_fill_keystore(const struct lyd_node *data, enum nc_operation op)
423423
{
424424
int ret = 0;
425425
uint32_t prev_lo;

src/server_config_p.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef enum {
4040
* @param[in] format Value of the YANG identityref.
4141
* @return Private key format on success, NC_PRIVKEY_FORMAT_UNKNOWN otherwise.
4242
*/
43-
NC_PRIVKEY_FORMAT nc_server_config_get_private_key_type(const char *format);
43+
enum nc_privkey_format nc_server_config_get_private_key_type(const char *format);
4444

4545
#endif /* NC_ENABLED_SSH_TLS */
4646

@@ -73,7 +73,7 @@ int nc_server_config_realloc(const char *key_value, void **ptr, size_t size, uin
7373
* @param[in] module Module for which to parse the data - either ietf-netconf-server, ietf-keystore or ietf-truststore
7474
* @return 0 on success, 1 on error.
7575
*/
76-
int nc_server_config_parse_tree(const struct lyd_node *node, NC_OPERATION parent_op, NC_MODULE module);
76+
int nc_server_config_parse_tree(const struct lyd_node *node, enum nc_operation parent_op, NC_MODULE module);
7777

7878
/**
7979
* @brief Configures the listen subtree in the ietf-netconf-server module.
@@ -82,7 +82,7 @@ int nc_server_config_parse_tree(const struct lyd_node *node, NC_OPERATION parent
8282
* @param[in] op Operation to be done on the subtree. Only does something if the operation is NC_OP_DELETE.
8383
* @return 0 on success, 1 on error.
8484
*/
85-
int nc_server_config_listen(const struct lyd_node *node, NC_OPERATION op);
85+
int nc_server_config_listen(const struct lyd_node *node, enum nc_operation op);
8686

8787
/**
8888
* @brief Configures the Call Home subtree in the ietf-netconf-server module.
@@ -91,7 +91,7 @@ int nc_server_config_listen(const struct lyd_node *node, NC_OPERATION op);
9191
* @param[in] op Operation to be done on the subtree. Only does something if the operation is NC_OP_DELETE.
9292
* @return 0 on success, 1 on error.
9393
*/
94-
int nc_server_config_ch(const struct lyd_node *node, NC_OPERATION op);
94+
int nc_server_config_ch(const struct lyd_node *node, enum nc_operation op);
9595

9696
#ifdef NC_ENABLED_SSH_TLS
9797

@@ -104,7 +104,7 @@ int nc_server_config_ch(const struct lyd_node *node, NC_OPERATION op);
104104
* @param[in] op Operation saying what to do with the top-level node.
105105
* @return 0 either if keystore is not present or if it is and application was successful, 1 on error.
106106
*/
107-
int nc_server_config_fill_keystore(const struct lyd_node *data, NC_OPERATION op);
107+
int nc_server_config_fill_keystore(const struct lyd_node *data, enum nc_operation op);
108108

109109
/**
110110
* @brief Parse the given node, which belongs to the ietf-keystore subtree, and apply it's data to the server's configuration.
@@ -113,7 +113,7 @@ int nc_server_config_fill_keystore(const struct lyd_node *data, NC_OPERATION op)
113113
* @param[in] op Operation saying what to do with the node.
114114
* @return 0 on success, 1 on error.
115115
*/
116-
int nc_server_config_parse_keystore(const struct lyd_node *node, NC_OPERATION op);
116+
int nc_server_config_parse_keystore(const struct lyd_node *node, enum nc_operation op);
117117

118118
/**
119119
* @brief Configures the keystore subtree in the ietf-keystore module.
@@ -122,7 +122,7 @@ int nc_server_config_parse_keystore(const struct lyd_node *node, NC_OPERATION op
122122
* @param[in] op Operation to be done on the subtree. Only does something if the operation is NC_OP_DELETE.
123123
* @return 0.
124124
*/
125-
int nc_server_config_ks_keystore(const struct lyd_node *node, NC_OPERATION op);
125+
int nc_server_config_ks_keystore(const struct lyd_node *node, enum nc_operation op);
126126

127127
/** TRUSTSTORE **/
128128

@@ -133,7 +133,7 @@ int nc_server_config_ks_keystore(const struct lyd_node *node, NC_OPERATION op);
133133
* @param[in] op Operation saying what to do with the top-level node.
134134
* @return 0 either if truststore is not present or if it is and application was successful, 1 on error.
135135
*/
136-
int nc_server_config_fill_truststore(const struct lyd_node *data, NC_OPERATION op);
136+
int nc_server_config_fill_truststore(const struct lyd_node *data, enum nc_operation op);
137137

138138
/**
139139
* @brief Parse the given node, which belongs to the ietf-truststore subtree, and apply it's data to the server's configuration.
@@ -142,7 +142,7 @@ int nc_server_config_fill_truststore(const struct lyd_node *data, NC_OPERATION o
142142
* @param[in] op Operation saying what to do with the node.
143143
* @return 0 on success, 1 on error.
144144
*/
145-
int nc_server_config_parse_truststore(const struct lyd_node *node, NC_OPERATION op);
145+
int nc_server_config_parse_truststore(const struct lyd_node *node, enum nc_operation op);
146146

147147
/**
148148
* @brief Configures the truststore subtree in the ietf-truststore module.
@@ -151,7 +151,7 @@ int nc_server_config_parse_truststore(const struct lyd_node *node, NC_OPERATION
151151
* @param[in] op Operation to be done on the subtree. Only does something if the operation is NC_OP_DELETE.
152152
* @return 0.
153153
*/
154-
int nc_server_config_ts_truststore(const struct lyd_node *node, NC_OPERATION op);
154+
int nc_server_config_ts_truststore(const struct lyd_node *node, enum nc_operation op);
155155

156156
/** LIBNETCONF2-NETCONF-SERVER **/
157157

@@ -162,7 +162,7 @@ int nc_server_config_ts_truststore(const struct lyd_node *node, NC_OPERATION op)
162162
* @param[in] op Operation to be done on the subtree. Only does something if the operation is NC_OP_DELETE.
163163
* @return 0 on success, 1 on error.
164164
*/
165-
int nc_server_config_ln2_netconf_server(const struct lyd_node *node, NC_OPERATION op);
165+
int nc_server_config_ln2_netconf_server(const struct lyd_node *node, enum nc_operation op);
166166

167167
#endif /* NC_ENABLED_SSH_TLS */
168168

src/server_config_ts.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ nc_server_config_ts_del_public_key_bag(struct nc_public_key_bag *pbag)
294294
}
295295

296296
static int
297-
nc_server_config_ts_certificate_bags(const struct lyd_node *node, NC_OPERATION op)
297+
nc_server_config_ts_certificate_bags(const struct lyd_node *node, enum nc_operation op)
298298
{
299299
uint16_t i, cert_bag_count;
300300
struct nc_truststore *ts = &server_opts.truststore;
@@ -312,7 +312,7 @@ nc_server_config_ts_certificate_bags(const struct lyd_node *node, NC_OPERATION o
312312
}
313313

314314
static int
315-
nc_server_config_ts_public_key_bags(const struct lyd_node *node, NC_OPERATION op)
315+
nc_server_config_ts_public_key_bags(const struct lyd_node *node, enum nc_operation op)
316316
{
317317
uint16_t i, pub_bag_count;
318318
struct nc_truststore *ts = &server_opts.truststore;
@@ -330,7 +330,7 @@ nc_server_config_ts_public_key_bags(const struct lyd_node *node, NC_OPERATION op
330330
}
331331

332332
int
333-
nc_server_config_ts_truststore(const struct lyd_node *node, NC_OPERATION op)
333+
nc_server_config_ts_truststore(const struct lyd_node *node, enum nc_operation op)
334334
{
335335
(void) node;
336336

@@ -354,7 +354,7 @@ nc_server_config_ts_create_certificate_bag(const struct lyd_node *node)
354354
}
355355

356356
static int
357-
nc_server_config_ts_certificate_bag(const struct lyd_node *node, NC_OPERATION op)
357+
nc_server_config_ts_certificate_bag(const struct lyd_node *node, enum nc_operation op)
358358
{
359359
struct nc_certificate_bag *bag;
360360

@@ -385,7 +385,7 @@ nc_server_config_ts_create_certificate(const struct lyd_node *node, struct nc_ce
385385
}
386386

387387
static int
388-
nc_server_config_ts_certificate(const struct lyd_node *node, NC_OPERATION op)
388+
nc_server_config_ts_certificate(const struct lyd_node *node, enum nc_operation op)
389389
{
390390
struct nc_certificate_bag *bag;
391391
struct nc_certificate *cert;
@@ -412,7 +412,7 @@ nc_server_config_ts_certificate(const struct lyd_node *node, NC_OPERATION op)
412412
}
413413

414414
static int
415-
nc_server_config_ts_cert_data(const struct lyd_node *node, NC_OPERATION op)
415+
nc_server_config_ts_cert_data(const struct lyd_node *node, enum nc_operation op)
416416
{
417417
struct nc_certificate *cert;
418418

@@ -441,7 +441,7 @@ nc_server_config_ts_create_public_key_bag(const struct lyd_node *node)
441441
}
442442

443443
static int
444-
nc_server_config_ts_public_key_bag(const struct lyd_node *node, NC_OPERATION op)
444+
nc_server_config_ts_public_key_bag(const struct lyd_node *node, enum nc_operation op)
445445
{
446446
struct nc_public_key_bag *pbag;
447447

@@ -472,7 +472,7 @@ nc_server_config_ts_create_public_key(const struct lyd_node *node, struct nc_pub
472472
}
473473

474474
static int
475-
nc_server_config_ts_public_key(const struct lyd_node *node, NC_OPERATION op)
475+
nc_server_config_ts_public_key(const struct lyd_node *node, enum nc_operation op)
476476
{
477477
int ret = 0;
478478
struct nc_public_key_bag *bag;
@@ -516,7 +516,7 @@ nc_server_config_ts_public_key(const struct lyd_node *node, NC_OPERATION op)
516516
}
517517

518518
static int
519-
nc_server_config_ts_public_key_format(const struct lyd_node *node, NC_OPERATION op)
519+
nc_server_config_ts_public_key_format(const struct lyd_node *node, enum nc_operation op)
520520
{
521521
const char *format;
522522
struct nc_public_key *pkey;
@@ -540,7 +540,7 @@ nc_server_config_ts_public_key_format(const struct lyd_node *node, NC_OPERATION
540540
}
541541

542542
int
543-
nc_server_config_parse_truststore(const struct lyd_node *node, NC_OPERATION op)
543+
nc_server_config_parse_truststore(const struct lyd_node *node, enum nc_operation op)
544544
{
545545
const char *name = LYD_NAME(node);
546546
int ret = 0;
@@ -574,7 +574,7 @@ nc_server_config_parse_truststore(const struct lyd_node *node, NC_OPERATION op)
574574
}
575575

576576
int
577-
nc_server_config_fill_truststore(const struct lyd_node *data, NC_OPERATION op)
577+
nc_server_config_fill_truststore(const struct lyd_node *data, enum nc_operation op)
578578
{
579579
int ret = 0;
580580
uint32_t prev_lo;

src/server_config_util.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ nc_server_config_check_delete(struct lyd_node **tree, const char *path_fmt, ...)
201201
#ifdef NC_ENABLED_SSH_TLS
202202

203203
const char *
204-
nc_server_config_util_privkey_format_to_identityref(NC_PRIVKEY_FORMAT format)
204+
nc_server_config_util_privkey_format_to_identityref(enum nc_privkey_format format)
205205
{
206206
switch (format) {
207207
case NC_PRIVKEY_FORMAT_RSA:
@@ -635,7 +635,7 @@ nc_server_config_util_get_spki_pubkey_file(const char *pubkey_path, char **pubke
635635
}
636636

637637
static int
638-
nc_server_config_util_get_privkey_format(const char *privkey, NC_PRIVKEY_FORMAT *privkey_format)
638+
nc_server_config_util_get_privkey_format(const char *privkey, enum nc_privkey_format *privkey_format)
639639
{
640640
NC_CHECK_ARG_RET(NULL, privkey, privkey_format, 1);
641641

@@ -757,7 +757,7 @@ nc_server_config_util_pem_strip_header_footer(const char *pem, char **privkey)
757757
}
758758

759759
static int
760-
nc_server_config_util_get_privkey(const char *privkey_path, NC_PRIVKEY_FORMAT *privkey_format, char **privkey, void **pkey)
760+
nc_server_config_util_get_privkey(const char *privkey_path, enum nc_privkey_format *privkey_format, char **privkey, void **pkey)
761761
{
762762
int ret = 0;
763763
FILE *f_privkey = NULL;
@@ -837,8 +837,8 @@ nc_server_config_util_get_privkey(const char *privkey_path, NC_PRIVKEY_FORMAT *p
837837
}
838838

839839
int
840-
nc_server_config_util_get_asym_key_pair(const char *privkey_path, const char *pubkey_path, NC_PUBKEY_FORMAT wanted_pubkey_format,
841-
char **privkey, NC_PRIVKEY_FORMAT *privkey_type, char **pubkey)
840+
nc_server_config_util_get_asym_key_pair(const char *privkey_path, const char *pubkey_path, enum nc_pubkey_format wanted_pubkey_format,
841+
char **privkey, enum nc_privkey_format *privkey_type, char **pubkey)
842842
{
843843
int ret = 0;
844844
void *pkey = NULL;
@@ -1003,7 +1003,7 @@ nc_server_config_add_keystore_asym_key(const struct ly_ctx *ctx, NC_TRANSPORT_IM
10031003
{
10041004
int ret = 0;
10051005
char *privkey = NULL, *pubkey = NULL;
1006-
NC_PRIVKEY_FORMAT privkey_type;
1006+
enum nc_privkey_format privkey_type;
10071007
const char *privkey_format, *pubkey_format;
10081008

10091009
NC_CHECK_ARG_RET(NULL, ctx, asym_key_name, privkey_path, config, 1);

src/server_config_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ typedef enum {
8585
* @param[out] pubkey Base64 encoded public key.
8686
* @return 0 on success, non-zero otherwise.
8787
*/
88-
int nc_server_config_util_get_asym_key_pair(const char *privkey_path, const char *pubkey_path, NC_PUBKEY_FORMAT wanted_pubkey_type,
89-
char **privkey, NC_PRIVKEY_FORMAT *privkey_type, char **pubkey);
88+
int nc_server_config_util_get_asym_key_pair(const char *privkey_path, const char *pubkey_path, enum nc_pubkey_format wanted_pubkey_type,
89+
char **privkey, enum nc_privkey_format *privkey_type, char **pubkey);
9090

9191
/**
9292
* @brief Gets public key from a file and converts it to the SSH format if need be.
@@ -115,7 +115,7 @@ int nc_server_config_util_read_certificate(const char *cert_path, char **cert);
115115
*
116116
* @return Identityref on success, NULL on failure.
117117
*/
118-
const char *nc_server_config_util_privkey_format_to_identityref(NC_PRIVKEY_FORMAT format);
118+
const char *nc_server_config_util_privkey_format_to_identityref(enum nc_privkey_format format);
119119

120120
#endif /* NC_ENABLED_SSH_TLS */
121121

src/server_config_util_ssh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ _nc_server_config_add_ssh_hostkey(const struct ly_ctx *ctx, const char *tree_pat
3838
{
3939
int ret = 0;
4040
char *pubkey = NULL, *privkey = NULL;
41-
NC_PRIVKEY_FORMAT privkey_type;
41+
enum nc_privkey_format privkey_type;
4242
const char *privkey_format, *pubkey_format = "ietf-crypto-types:ssh-public-key-format";
4343

4444
NC_CHECK_ARG_RET(NULL, ctx, tree_path, privkey_path, config, 1);

src/server_config_util_tls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ _nc_server_config_add_tls_server_cert(const struct ly_ctx *ctx, const char *tree
3838
{
3939
int ret = 0;
4040
char *privkey = NULL, *pubkey = NULL, *cert = NULL;
41-
NC_PRIVKEY_FORMAT privkey_type;
41+
enum nc_privkey_format privkey_type;
4242
const char *privkey_format, *pubkey_format = "ietf-crypto-types:subject-public-key-info-format";
4343

4444
NC_CHECK_ARG_RET(NULL, ctx, tree_path, privkey_path, cert_path, config, 1);

src/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ nc_base64der_to_cert(const char *data)
164164
}
165165

166166
const char *
167-
nc_privkey_format_to_str(NC_PRIVKEY_FORMAT format)
167+
nc_privkey_format_to_str(enum nc_privkey_format format)
168168
{
169169
switch (format) {
170170
case NC_PRIVKEY_FORMAT_RSA:

0 commit comments

Comments
 (0)