1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/* Copyright 2002 Jeff Dike
* Licensed under the GPL
*/
#ifndef __PORT_H__
#define __PORT_H__
#include <sys/socket.h>
#include <sys/un.h>
struct netjig_state;
struct nethub;
struct port;
struct packet;
typedef void (*packet_sender)(int fd, void *packet, int len, void *data);
/* in port.c */
extern void handle_sock_data(struct netjig_state *ns,
struct nethub *nh);
extern void handle_tap_data(struct netjig_state *ns,
struct nethub *nh);
extern void handle_port(struct netjig_state *ns,
struct nethub *nh,
struct pollfd *l_fds,
int l_nfds,
int *l_fd_array,
int l_fd_array_size);
extern void handle_data(struct netjig_state *ns,
struct nethub *nh,
struct packet *packet, int len,
int fd,
void *data, int (*matcher)(int port_fd, int data_fd,
void *port_data,
int port_data_len,
void *data));
void insert_data(struct netjig_state *ns,
struct nethub *nh,
struct packet *packet, int len);
extern void close_port(struct netjig_state *ns,
struct nethub *nh,
int fd);
extern int setup_sock_port(struct netjig_state *ns,
struct nethub *nh,
struct port *port,
struct sockaddr_un *name);
extern void setup_port(struct netjig_state *ns,
struct nethub *nh,
struct port *port,
int fd,
void (*sender)(int fd, void *packet, int len,
void *data),
void *data, int data_len);
extern struct port *alloc_port(struct netjig_state *ns,
struct nethub *nh);
extern int setup_sock_tap(struct netjig_state *ns,
struct nethub *nh,
int fd,
packet_sender tap_sender);
extern void accept_connection(struct netjig_state *ns, struct nethub *nh);
#endif
|