Line data Source code
1 : #ifndef _SENTINEL_MINIPOT_CONFIG_H_ 2 : #define _SENTINEL_MINIPOT_CONFIG_H_ 3 : 4 : #include <stdint.h> 5 : #include <string.h> 6 : 7 : struct minipot_config { 8 : char *config_file; 9 : char *zmq_endopint; 10 : char *topic; 11 : char *user; 12 : uint16_t *ports; 13 : // number of configured ports 14 : size_t ports_cnt; 15 : // size of ports 16 : size_t ports_size; 17 : }; 18 : 19 : // Initializes an instance - allocates its resources. 20 0 : void minipot_config_init(struct minipot_config *cfg); 21 : 22 : // Deinitializes an instance - frees its resources. 23 0 : void minipot_config_destroy(struct minipot_config *cfg); 24 : 25 : // Check if configuration has defined all needed parameters. 26 : // Doesn't check the value of parameters. It only check if they were defined. 27 : // If any critical parameter is missing it aborts the program. 28 0 : void minipot_config_check(struct minipot_config *cfg); 29 : 30 : // Returns pointer to string representing configuration. 31 : // Caller is responisble for freeing it. 32 0 : char *minipot_config_2str(struct minipot_config *cfg); 33 : 34 : #endif