xref: /openbmc/obmc-console/config.h (revision e3a083eb)
11e04f449SAlexander Hansen /**
21e04f449SAlexander Hansen  * Copyright © 2016 IBM
31e04f449SAlexander Hansen  * Copyright © 2024 9elements
41e04f449SAlexander Hansen  *
51e04f449SAlexander Hansen  * Licensed under the Apache License, Version 2.0 (the "License");
61e04f449SAlexander Hansen  * you may not use this file except in compliance with the License.
71e04f449SAlexander Hansen  * You may obtain a copy of the License at
81e04f449SAlexander Hansen  *
91e04f449SAlexander Hansen  *     http://www.apache.org/licenses/LICENSE-2.0
101e04f449SAlexander Hansen  *
111e04f449SAlexander Hansen  * Unless required by applicable law or agreed to in writing, software
121e04f449SAlexander Hansen  * distributed under the License is distributed on an "AS IS" BASIS,
131e04f449SAlexander Hansen  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141e04f449SAlexander Hansen  * See the License for the specific language governing permissions and
151e04f449SAlexander Hansen  * limitations under the License.
161e04f449SAlexander Hansen  */
171e04f449SAlexander Hansen 
181e04f449SAlexander Hansen #pragma once
191e04f449SAlexander Hansen 
201e04f449SAlexander Hansen #include <stdint.h>
211e04f449SAlexander Hansen #include <termios.h>
221e04f449SAlexander Hansen 
231e04f449SAlexander Hansen struct config;
241e04f449SAlexander Hansen 
25*e3a083ebSAlexander Hansen const char *config_get_section_value(struct config *config, const char *secname,
26*e3a083ebSAlexander Hansen 				     const char *name);
271e04f449SAlexander Hansen const char *config_get_value(struct config *config, const char *name);
281e04f449SAlexander Hansen struct config *config_init(const char *filename);
291e04f449SAlexander Hansen const char *config_resolve_console_id(struct config *config,
301e04f449SAlexander Hansen 				      const char *id_arg);
311e04f449SAlexander Hansen void config_fini(struct config *config);
321e04f449SAlexander Hansen 
331e04f449SAlexander Hansen int config_parse_baud(speed_t *speed, const char *baud_string);
341e04f449SAlexander Hansen uint32_t parse_baud_to_int(speed_t speed);
351e04f449SAlexander Hansen speed_t parse_int_to_baud(uint32_t baud);
361e04f449SAlexander Hansen int config_parse_bytesize(const char *size_str, size_t *size);
37*e3a083ebSAlexander Hansen 
38*e3a083ebSAlexander Hansen int config_count_sections(struct config *config);
39*e3a083ebSAlexander Hansen const char *config_get_section_name(struct config *config, int i);
40