devtools/cocci: create safer version of strlcpy script
[dpdk.git] / lib / librte_cmdline / cmdline_parse_etheraddr.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation.
3  * Copyright (c) 2009, Olivier MATZ <zer0@droids-corp.org>
4  * All rights reserved.
5  */
6
7 #ifndef _PARSE_ETHERADDR_H_
8 #define _PARSE_ETHERADDR_H_
9
10 #include <cmdline_parse.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 struct cmdline_token_etheraddr {
17         struct cmdline_token_hdr hdr;
18 };
19 typedef struct cmdline_token_etheraddr cmdline_parse_token_etheraddr_t;
20
21 extern struct cmdline_token_ops cmdline_token_etheraddr_ops;
22
23 int cmdline_parse_etheraddr(cmdline_parse_token_hdr_t *tk, const char *srcbuf,
24         void *res, unsigned ressize);
25 int cmdline_get_help_etheraddr(cmdline_parse_token_hdr_t *tk, char *dstbuf,
26         unsigned int size);
27
28 #define TOKEN_ETHERADDR_INITIALIZER(structure, field)       \
29 {                                                           \
30         /* hdr */                                               \
31         {                                                       \
32                 &cmdline_token_etheraddr_ops,   /* ops */           \
33                 offsetof(structure, field),     /* offset */        \
34         },                                                      \
35 }
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41
42 #endif /* _PARSE_ETHERADDR_H_ */