2004-06-03 16:45:53 +00:00
|
|
|
#ifndef _LISTENER_H
|
|
|
|
#define _LISTENER_H
|
|
|
|
|
|
|
|
#define MAX_LISTENERS 20
|
|
|
|
#define LISTENER_EXTEND_SIZE 1
|
|
|
|
|
|
|
|
struct Listener {
|
|
|
|
|
2004-08-10 17:09:52 +00:00
|
|
|
int socks[DROPBEAR_MAX_SOCKS];
|
|
|
|
unsigned int nsocks;
|
2004-06-03 16:45:53 +00:00
|
|
|
|
|
|
|
int index; /* index in the array of listeners */
|
|
|
|
|
2004-08-11 17:26:47 +00:00
|
|
|
void (*acceptor)(struct Listener*, int sock);
|
2004-06-03 16:45:53 +00:00
|
|
|
void (*cleanup)(struct Listener*);
|
|
|
|
|
|
|
|
int type; /* CHANNEL_ID_X11, CHANNEL_ID_AGENT,
|
|
|
|
CHANNEL_ID_TCPDIRECT (for clients),
|
|
|
|
CHANNEL_ID_TCPFORWARDED (for servers) */
|
|
|
|
|
|
|
|
void *typedata;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2004-06-03 18:08:34 +00:00
|
|
|
void listeners_initialise();
|
2004-06-03 16:45:53 +00:00
|
|
|
void handle_listeners(fd_set * readfds);
|
|
|
|
void set_listener_fds(fd_set * readfds);
|
|
|
|
|
2004-08-10 17:09:52 +00:00
|
|
|
struct Listener* new_listener(int socks[], unsigned int nsocks,
|
|
|
|
int type, void* typedata,
|
2004-08-11 17:26:47 +00:00
|
|
|
void (*acceptor)(struct Listener* listener, int sock),
|
2004-06-03 16:45:53 +00:00
|
|
|
void (*cleanup)(struct Listener*));
|
|
|
|
|
|
|
|
struct Listener * get_listener(int type, void* typedata,
|
|
|
|
int (*match)(void*, void*));
|
|
|
|
|
|
|
|
void remove_listener(struct Listener* listener);
|
|
|
|
|
|
|
|
#endif /* _LISTENER_H */
|