summaryrefslogtreecommitdiffstats
path: root/src/device.h
blob: f4370214ca46de4ee328bf540fae262bbbb44626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include "config-ini.h"

#include <libubox/avl.h>

extern struct avl_tree device_types;

typedef struct _device_type device_type_t;

typedef struct _device {
	struct avl_node node;
	const device_type_t *type;
} device_t;

struct _device_type {
	struct avl_node node;
	device_t * (*process_config)(const char *name, const ini_file_t *config);
	void (*free_device)(device_t *device);
};

void register_device_type(const char *name, device_type_t *device_type);
const device_type_t * get_device_type(const char *name);