1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation. 3 * Copyright (c) 2010, Keith Wiles <keith.wiles@windriver.com> 4 * All rights reserved. 5 */ 6 7 #ifndef _PARSE_PORTLIST_H_ 8 #define _PARSE_PORTLIST_H_ 9 10 #include <stdint.h> 11 #include <cmdline_parse.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /* size of a parsed string */ 18 #define PORTLIST_TOKEN_SIZE 128 19 #define PORTLIST_MAX_TOKENS 32 20 21 typedef struct cmdline_portlist { 22 uint32_t map; 23 } cmdline_portlist_t; 24 25 struct cmdline_token_portlist { 26 struct cmdline_token_hdr hdr; 27 }; 28 typedef struct cmdline_token_portlist cmdline_parse_token_portlist_t; 29 30 extern struct cmdline_token_ops cmdline_token_portlist_ops; 31 32 int cmdline_parse_portlist(cmdline_parse_token_hdr_t *tk, 33 const char *srcbuf, void *res, unsigned ressize); 34 int cmdline_get_help_portlist(cmdline_parse_token_hdr_t *tk, 35 char *dstbuf, unsigned int size); 36 37 #define TOKEN_PORTLIST_INITIALIZER(structure, field) \ 38 { \ 39 /* hdr */ \ 40 { \ 41 &cmdline_token_portlist_ops, /* ops */ \ 42 offsetof(structure, field), /* offset */ \ 43 }, \ 44 } 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 #endif /* _PARSE_PORTLIST_H_ */ 51