#ifndef _AGENT_SERVER_H_6f08ed44_ #define _AGENT_SERVER_H_6f08ed44_ /* This file is in the public domain. */ #include "agent.h" /* * External interface to the agent server code. */ /* * agent_setup() implements -agent. It forks a child which runs the * command, while the calling process becomes the agent itself. */ extern void agent_setup(void); /* * agent_listener(path,haveconn,cookie,envstr,flags) creates an agent * listener. This is used by agent_setup, but is also used by the * server side of agent forwarding. path is the path to listen on. * haveconn(fd,cookie,proto) is called when a connection is noticed, * with the fd of the new connection, the cookie from the call that * set up the listener, and one of the AGENT_PROTO_ values indicating * which protocol the connection is using. cookie is an opaque * argument passed to haveconn. envstr receives a string to be put in * $SSH_AGENT; the caller is responsible for freeing it when * appropriate. flags contains flag bits: * * ALF_MUSTWORK * Specifies whether failure should produce a complaint * and exit (if set) or failure return (if clear). * ALF_JUSTONCE * Specifies whether the forwarding should be established * for just one use (if set) or potentially many uses (if * clear). * * Return value is a nil pointer on failure or an opaque handle on * success. */ extern void *agent_listener(const char *, void (*)(int, void *, AGENT_PROTO), void *, char **, unsigned int); #define ALF_MUSTWORK 0x00000001 #define ALF_JUSTONCE 0x00000002 /* * agent_listener_abort(handle) takes the opaque cookie returned by * agent_listener and tears down the listener. */ extern void agent_listener_abort(void *); /* * agent_dir(0 returns a path to the directory which agent listener * sockets should be created in. This is used to create paths to pass * to agent_listener. */ extern char *agent_dir(void); #endif