patty/include/patty/ax25/call.h

135 lines
3 KiB
C

#ifndef _PATTY_AX25_CALL_H
#define _PATTY_AX25_CALL_H
enum patty_ax25_call {
PATTY_AX25_CALL_NONE,
PATTY_AX25_CALL_SOCKET,
PATTY_AX25_CALL_BIND,
PATTY_AX25_CALL_LISTEN,
PATTY_AX25_CALL_ACCEPT,
PATTY_AX25_CALL_CONNECT,
PATTY_AX25_CALL_CLOSE,
PATTY_AX25_CALL_SENDTO,
PATTY_AX25_CALL_RECVFROM,
PATTY_AX25_CALL_COUNT
};
/*
* socket()
*/
typedef struct _patty_ax25_call_socket_request {
int type;
} patty_ax25_call_socket_request;
typedef struct _patty_ax25_response_socket {
int ret;
int eno;
} patty_ax25_call_socket_response;
int patty_ax25_call_socket(int server,
int type);
/*
* bind()
*/
typedef struct _patty_ax25_call_bind_request {
int socket;
patty_ax25_addr peer;
} patty_ax25_call_bind_request;
typedef struct _patty_ax25_call_bind_response {
int ret;
int eno;
} patty_ax25_call_bind_response;
int patty_ax25_call_bind(int server,
int socket,
patty_ax25_addr *addr);
/*
* listen()
*/
typedef struct _patty_ax25_call_listen_request {
int socket;
} patty_ax25_call_listen_request;
typedef struct _patty_ax25_call_listen_response {
int ret;
int eno;
} patty_ax25_call_listen_response;
int patty_ax25_call_listen(int server,
int socket);
/*
* accept()
*/
typedef struct _patty_ax25_call_accept_request {
int socket;
} patty_ax25_call_accept_request;
typedef struct _patty_ax25_call_accept_response {
int ret;
int eno;
char path[PATTY_AX25_SOCK_PATH_SIZE];
patty_ax25_addr peer;
} patty_ax25_call_accept_response;
int patty_ax25_call_accept(int server,
int socket,
patty_ax25_addr *peer,
char *path);
/*
* connect()
*/
typedef struct _patty_ax25_call_connect_request {
int socket;
patty_ax25_addr peer;
} patty_ax25_call_connect_request;
typedef struct _patty_ax25_call_connect_response {
int ret;
int eno;
char path[PATTY_AX25_SOCK_PATH_SIZE];
} patty_ax25_call_connect_response;
int patty_ax25_call_connect(int server,
int socket,
patty_ax25_addr *peer,
char *path);
/*
* close()
*/
typedef struct _patty_ax25_call_close_request {
int socket;
} patty_ax25_call_close_request;
typedef struct _patty_ax25_call_close_response {
int ret;
int eno;
} patty_ax25_call_close_response;
int patty_ax25_call_close(int server,
int socket);
/*
* sendto()
*/
ssize_t patty_ax25_call_sendto(int server,
int socket,
const void *buf,
size_t len,
patty_ax25_addr *addr);
/*
* recvfrom()
*/
int patty_ax25_call_recvfrom(int server,
int socket,
void *buf,
size_t len,
patty_ax25_addr *addr);
#endif /* _PATTY_AX25_CALL_H */