patty/include/patty/ax25.h

80 lines
1.7 KiB
C
Raw Normal View History

2015-07-03 03:02:22 +00:00
#ifndef _PATTY_AX25_H
#define _PATTY_AX25_H
2015-07-20 02:22:41 -05:00
#include <stdint.h>
#include <sys/types.h>
#include <patty/kiss.h>
2015-07-23 23:55:44 +00:00
#include <patty/list.h>
2015-07-20 02:22:41 -05:00
#include <patty/dict.h>
2015-07-24 22:28:39 +00:00
#include <patty/ax25/defs.h>
#include <patty/ax25/macros.h>
2015-07-18 12:06:25 -05:00
#include <patty/ax25/proto.h>
2015-07-23 23:55:44 +00:00
#include <patty/ax25/address.h>
2015-07-18 12:06:25 -05:00
#include <patty/ax25/frame.h>
2015-07-24 22:28:39 +00:00
#include <patty/ax25/if.h>
2015-07-24 21:07:03 -05:00
enum patty_ax25_event {
PATTY_AX25_IO_UNKNOWN,
PATTY_AX25_IO_RECV,
PATTY_AX25_IO_SEND,
PATTY_AX25_IO_READ,
PATTY_AX25_IO_WRITE
};
2015-07-20 02:22:41 -05:00
2015-07-25 14:43:45 -05:00
typedef struct _patty_ax25_sock {
enum patty_ax25_obj_type type;
2015-07-25 19:39:35 -05:00
patty_ax25_if * iface;
patty_ax25_address * local;
patty_ax25_address * remote;
2015-07-25 14:43:45 -05:00
} patty_ax25_sock;
struct _patty_ax25 {
patty_list * ifaces;
patty_list * socks;
2015-07-25 14:43:45 -05:00
patty_dict * fd_lookup;
int fd;
};
2015-07-20 22:33:59 -05:00
int patty_ax25_init(patty_ax25 *ax25);
2015-07-21 01:01:41 -05:00
void patty_ax25_stop(patty_ax25 *ax25);
2015-07-20 21:27:35 +00:00
2015-07-24 21:07:03 -05:00
int patty_ax25_open(patty_ax25 *ax25, const char *ifname);
int patty_ax25_socket(patty_ax25 *ax25);
int patty_ax25_bind(patty_ax25 *ax25,
int socket, const char *callsign, int ssid);
2015-07-24 21:07:03 -05:00
int patty_ax25_listen(patty_ax25 *ax25,
int socket, const char *callsign, int ssid);
int patty_ax25_connect(patty_ax25 *ax25,
int socket, const char *callsign, int ssid);
int patty_ax25_accept(patty_ax25 *ax25,
int socket);
int patty_ax25_close(patty_ax25 *ax25, int fd);
int patty_ax25_wait(patty_ax25 *ax25,
int fds, enum patty_ax25_event *ev);
int patty_ax25_recv(patty_ax25 *ax25,
int fd, patty_ax25_frame *frame);
int patty_ax25_send(patty_ax25 *ax25,
int fd, patty_ax25_frame *frame);
ssize_t patty_ax25_read(patty_ax25 *ax25,
int fd, void *data, size_t len);
ssize_t patty_ax25_write(patty_ax25 *ax25,
int fd, const void *data, size_t len);
#endif /* _PATTY_AX25_H */