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