view listener.h @ 66:38c3146aa23d

Some more sanity-checking of args, and just warn and ignore OpenSSH args
author Matt Johnston <>
date Thu, 12 Aug 2004 14:19:05 +0000
parents dcc43965928f
children e3adf4cf5465
line wrap: on
line source
#ifndef _LISTENER_H
#define _LISTENER_H

#define MAX_LISTENERS 20

struct Listener {

	unsigned int nsocks;

	int index; /* index in the array of listeners */

	void (*acceptor)(struct Listener*, int sock);
	void (*cleanup)(struct Listener*);

	int type; /* CHANNEL_ID_X11, CHANNEL_ID_AGENT, 
				 CHANNEL_ID_TCPDIRECT (for clients),
				 CHANNEL_ID_TCPFORWARDED (for servers) */

	void *typedata;


void listeners_initialise();
void handle_listeners(fd_set * readfds);
void set_listener_fds(fd_set * readfds);

struct Listener* new_listener(int socks[], unsigned int nsocks, 
		int type, void* typedata, 
		void (*acceptor)(struct Listener* listener, int sock), 
		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 */