Implement src/daemon.c to provide a high level method to instantiate a patty server Changes: * Refactor src/server.c, src/route.c, src/if.c methods which accept callsign arguments to use a patty_ax25_addr pointer instead; this has significantly reduced the number of redundant calls to patty_ax25_pton() * Decouple patty_ax25_addr from patty_ax25_if_info types when creating new interfaces with patty_ax25_if_new(); instead, take a separate patty_ax25_addr argument * Split patty_ax25_server_run() into the following methods: - patty_ax25_server_start() - patty_ax25_server_stop() - patty_ax25_server_event_handle() This is intended to allow possible integration into other event loops. * Implement src/daemon.c to allow quick instantiation of a server, interfaces, and routes, and to encapsulate the setting of configuration variables; callsigns and interface names are handled as character strings * Rename examples/server.c to examples/daemon.c; reimplement in terms of the patty_daemon code *
41 lines
1.4 KiB
C
41 lines
1.4 KiB
C
#ifndef _PATTY_AX25_ROUTE_H
|
|
#define _PATTY_AX25_ROUTE_H
|
|
|
|
typedef struct _patty_ax25_route {
|
|
patty_ax25_if *iface;
|
|
|
|
patty_ax25_addr dest,
|
|
repeaters[PATTY_AX25_MAX_HOPS];
|
|
|
|
size_t hops;
|
|
} patty_ax25_route;
|
|
|
|
typedef struct _patty_dict patty_ax25_route_table;
|
|
|
|
patty_ax25_route *patty_ax25_route_new(patty_ax25_if *iface,
|
|
patty_ax25_addr *dest,
|
|
patty_ax25_addr *repeaters,
|
|
int hops);
|
|
|
|
patty_ax25_route *patty_ax25_route_new_default(patty_ax25_if *iface);
|
|
|
|
patty_ax25_route_table *patty_ax25_route_table_new();
|
|
|
|
void patty_ax25_route_table_destroy(patty_ax25_route_table *table);
|
|
|
|
int patty_ax25_route_table_add(patty_ax25_route_table *table,
|
|
patty_ax25_route *route);
|
|
|
|
int patty_ax25_route_table_delete(patty_ax25_route_table *route,
|
|
patty_ax25_addr *dest);
|
|
|
|
patty_ax25_route *patty_ax25_route_table_find(patty_ax25_route_table *table,
|
|
patty_ax25_addr *dest);
|
|
|
|
patty_ax25_route *patty_ax25_route_table_default(patty_ax25_route_table *table);
|
|
|
|
int patty_ax25_route_table_each(patty_ax25_route_table *table,
|
|
int (*callback)(patty_ax25_route *, void *),
|
|
void *ctx);
|
|
|
|
#endif /* _PATTY_AX25_ROUTE_H */
|