blob: 0a8a4cd1d4b10a0885eb30798882aa3c125e7502 [file] [log] [blame]
Alexander Hansen1e04f442024-06-12 16:35:58 +02001/**
2 * Copyright © 2016 IBM
3 * Copyright © 2024 9elements
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include <stdint.h>
21#include <termios.h>
22
23struct config;
24
Alexander Hansene3a083e2024-07-08 15:30:35 +020025const char *config_get_section_value(struct config *config, const char *secname,
26 const char *name);
Alexander Hansen1e04f442024-06-12 16:35:58 +020027const char *config_get_value(struct config *config, const char *name);
28struct config *config_init(const char *filename);
29const char *config_resolve_console_id(struct config *config,
30 const char *id_arg);
31void config_fini(struct config *config);
32
33int config_parse_baud(speed_t *speed, const char *baud_string);
34uint32_t parse_baud_to_int(speed_t speed);
35speed_t parse_int_to_baud(uint32_t baud);
36int config_parse_bytesize(const char *size_str, size_t *size);
Alexander Hansene3a083e2024-07-08 15:30:35 +020037
38int config_count_sections(struct config *config);
39const char *config_get_section_name(struct config *config, int i);