⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socks.h

📁 sock protocol ,it is useful!
💻 H
📖 第 1 页 / 共 2 页
字号:
 * the remote peer is expected to send data in. * * Returns: *		On success: 0 *		On failure: -1 */	/*	 *  Misc. functions to help keep track of our connection(s) to the server.	*/struct socksfd_t *socks_addaddr __P((unsigned int clientfd, struct socksfd_t *socksaddress));/* * "clientfd" is associated with the structure "socksfd". * The function duplicates all arguments in it's own form and does * not access the memory referenced by them afterwards. * * The function checks the state of all filedescriptors on each call and * removes those that are no longer open. * * Returns: *		On success: pointer to the added socksfd_t structure. *		On failure: exits.  (memory exhausted and process grew descriptor size.) * */struct socksfd_t *socks_getaddr __P((unsigned int fd));/* * Returns: *		On success:  the socketaddress associated with filedescriptor "fd". *		On failure:	 NULL.  (no socketaddress associated with "fd"). */voidsocks_rmaddr __P((unsigned int s));/* * removes the association for the socket "s", also closes the server * connection.  If "s" is not registered the request is ignored. */struct socksfd_t *socksfddup __P((const struct socksfd_t *old, struct socksfd_t *new));/* * Duplicates "old", in "new". * Returns: *		On success: "new". *		On failure: NULL (resource shortage). */intsocks_addrcontrol __P((const struct sockaddr *local,							  const struct sockaddr *remote));/* * Goes through all addresses registered and tries to find one where * the control socket has a local address of "local" and peer address * of "remote".  If either of "local" or "remote" is NULL, that * endpoint is not checked against. *	Returns: *		On success: the descriptor the socksfd struct was registered with. *		On failure: -1 */intsocks_addrmatch __P((const struct sockaddr *local,							const struct sockaddr *remote,							const struct socksstate_t *state));/* * Goes through all addresses registered and tries to find one where * all arguments match. * Arguments that are NULL or have "illegal" values are ignored. * Returns: *		On success: the descriptor the socksfd with matching arguments was *                registered with (>= 0). *		On failure: -1. */intsocks_isaddr __P((unsigned int fd));/* * Returns true if there is a address registered for the socket "fd", false * otherwise. */intsocks_addrisok __P((unsigned int s));/* * Compares the current address of "s" to the registered address. * If there is a mismatch, the function will try to correct it if possible. * Returns: *		If current address found to match registered: true. *		Else: false. */intsocks_addfd __P((unsigned int fd));/* * adds the filedescriptor "fd" to an internal table. * If it is already in the table the  request is ignored. * Returns: *		On success: 0 *		On failure: -1 */intsocks_isfd __P((unsigned int fd));/* * returns 1 if "fd" is a filedescriptor in our internal table, 0 if not. */voidsocks_rmfd __P((unsigned int fd));/* * removes the filedescriptor "fd" from our internal table. */intfdisopen __P((int fd));/* * returns 1 if the filedescriptor "fd" currently references a open object. * returns 0 otherwise. */intclientmethod_uname __P((int s, const struct sockshost_t *host, int version));/* * Enters username/password negotiation with the socksserver connected to * the socket "s". * "host" gives the name of the server. * "version" gives the socksversion established to use. * Returns: *		On success: 0 *		On failure: whatever the remote socksserver returned as status. */char *socks_getusername __P((const struct sockshost_t *host, char *buf,							  size_t buflen));/* * Tries to determine the username of the current user, to be used * when negotiating with the server "host". * The NUL-terminated username is written to "buf", which is of length * "buflen". * Returns: *		On success: pointer to "buf" with the username. *		On failure: NULL. */char *socks_getpassword __P((const struct sockshost_t *host, const char *user,							  char *buf, size_t buflen));/* * Tries to determine the password of user "user", to be used * when negotiating with the server "host". * The NUL-terminated password is written to "buf", which is of length * "buflen" * Returns: *		On success: pointer to "buf" with the password. *		On failure: NULL. */intsend_interfacerequest __P((int s, const struct interfacerequest_t *ifreq,								   int version));/* * Sends the interfacerequest "ifreq" to server connected to "s". * "version" is the protocolversion previously negotiated with server. *  Returns: *			On success: 0 *			On failure: -1 */intserverreplyisok __P((int version, int reply, struct route_t *route));/* * "replycode" is the reply code returned by a socksserver of version * "version". * "route" is the route that was used for the socksserver.  If * the errorcode indicates a serverfailure, it might be "badrouted". * Returns true if the reply indicates request succeeded, false otherwise * and sets errno accordingly. */intmsproxy_negotiate __P((int s, int control, struct socks_t *packet));/* * Negotiates with the msproxy server connected to "control". * "s" gives the socket to be used for dataflow. * "packet" contains the request and on return from the function * contains the response. * Returns: *		On success: 0 *		On failure: -1 */intsend_msprequest __P((int s, struct msproxy_state_t *state,						  struct msproxy_request_t *packet));/* * Sends a msproxy request to "s". * "state" is the current state of the connection to "s", * "packet" is the request to send. */intrecv_mspresponse __P((int s, struct msproxy_state_t *state,						  struct msproxy_response_t *packet));/* * Receives a msproxy response from "s". * "state" is the current state of the connection to "s", * "packet" is the memory the response is read into. */intmsproxy_sigio __P((int s));/* * Must be called on sockets where we expect the connection to be forwarded * by the msproxy server. * "s" is the socket and must have been added with socks_addaddr() beforehand. * Returns: *		On success: 0 *		On failure: -1 */intmsproxy_init __P((void));/* * inits things for using a msproxyserver. *		On success: 0 *		On failure: -1 */#if DIAGNOSTICvoidcc_socksfdv(int sig);/* * concistencycheck on socksfdv. */#endif#ifdef SOCKSLIBRARY_DYNAMICint sys_rresvport __P((int *));int sys_bindresvport __P((int, struct sockaddr_in *));struct hostent *sys_gethostbyname __P((const char *));struct hostent *sys_gethostbyname2 __P((const char *, int));HAVE_PROT_READ_0 sys_read__P((HAVE_PROT_READ_1, HAVE_PROT_READ_2, HAVE_PROT_READ_3));HAVE_PROT_READV_0 sys_readv__P((HAVE_PROT_READV_1, HAVE_PROT_READV_2, HAVE_PROT_READV_3));HAVE_PROT_RECV_0 sys_recv__P((HAVE_PROT_RECV_1, HAVE_PROT_RECV_2, HAVE_PROT_RECV_3, HAVE_PROT_RECV_4));HAVE_PROT_RECVMSG_0 sys_recvmsg__P((HAVE_PROT_RECVMSG_1, HAVE_PROT_RECVMSG_2, HAVE_PROT_RECVMSG_3));HAVE_PROT_SEND_0 sys_send__P((HAVE_PROT_SEND_1 , HAVE_PROT_SEND_2, HAVE_PROT_SEND_3, HAVE_PROT_SEND_4));HAVE_PROT_WRITE_0 sys_write__P((HAVE_PROT_WRITE_1, HAVE_PROT_WRITE_2, HAVE_PROT_WRITE_3));#if HAVE_OSF_OLDSTYLEint sys_accept __P((int, struct sockaddr *, int *));#elseHAVE_PROT_ACCEPT_0 sys_accept__P((HAVE_PROT_ACCEPT_1, HAVE_PROT_ACCEPT_2, HAVE_PROT_ACCEPT_3));#endif  /* HAVE_EXTRA_OSF_SYMBOLS */#if HAVE_OSF_OLDSTYLEint sys_bind __P((int, const struct sockaddr *, int));#elseHAVE_PROT_BIND_0 sys_bind__P((HAVE_PROT_BIND_1, HAVE_PROT_BIND_2, HAVE_PROT_BIND_3));#endif /* !HAVE_OSF_OLDSTYLE */#if HAVE_OSF_OLDSTYLEint sys_connect __P((int, const struct sockaddr *, int));#elseHAVE_PROT_CONNECT_0 sys_connect__P((HAVE_PROT_CONNECT_1, HAVE_PROT_CONNECT_2, HAVE_PROT_CONNECT_3));#endif  /* HAVE_OSF_OLDSTYLE */#if HAVE_OSF_OLDSTYLEint sys_getpeername __P((int, struct sockaddr *, int *));#elseHAVE_PROT_GETPEERNAME_0 sys_getpeername__P((HAVE_PROT_GETPEERNAME_1, HAVE_PROT_GETPEERNAME_2, HAVE_PROT_GETPEERNAME_3));#endif  /* HAVE_EXTRA_OSF_SYMBOLS */#if HAVE_OSF_OLDSTYLEint sys_getsockname __P((int, struct sockaddr *, int *));#elseHAVE_PROT_GETSOCKNAME_0 sys_getsockname__P((HAVE_PROT_GETSOCKNAME_1, HAVE_PROT_GETSOCKNAME_2, HAVE_PROT_GETSOCKNAME_3));#endif  /* HAVE_EXTRA_OSF_SYMBOLS */#if HAVE_OSF_OLDSTYLEint sys_recvfrom __P((int, void*, int, int, struct sockaddr *, int *));#elseHAVE_PROT_RECVFROM_0 sys_recvfrom__P((HAVE_PROT_RECVFROM_1, HAVE_PROT_RECVFROM_2, HAVE_PROT_RECVFROM_3, HAVE_PROT_RECVFROM_4, HAVE_PROT_RECVFROM_5, HAVE_PROT_RECVFROM_6));#endif#if HAVE_OSF_OLDSTYLEssize_t sys_writev __P((int, struct iovec *, int));#elseHAVE_PROT_WRITEV_0 sys_writev__P((HAVE_PROT_WRITEV_1, HAVE_PROT_WRITEV_2, HAVE_PROT_WRITEV_3));#endif#if HAVE_OSF_OLDSTYLEssize_t sys_sendmsg __P((int, struct msghdr *, int));#elseHAVE_PROT_SENDMSG_0 sys_sendmsg__P((HAVE_PROT_SENDMSG_1, HAVE_PROT_SENDMSG_2, HAVE_PROT_SENDMSG_3));#endif#if HAVE_OSF_OLDSTYLEint sys_sendto __P((int, const void *, int, int, const struct sockaddr *, socklen_t));#elseHAVE_PROT_SENDTO_0 sys_sendto__P((HAVE_PROT_SENDTO_1, HAVE_PROT_SENDTO_2, HAVE_PROT_SENDTO_3, HAVE_PROT_SENDTO_4, HAVE_PROT_SENDTO_5, HAVE_PROT_SENDTO_6));#endif /* !HAVE_OSF_OLDSTYLE */#if HAVE_EXTRA_OSF_SYMBOLSint sys_Eaccept __P((int, struct sockaddr *, socklen_t *));int sys_Egetpeername __P((int, struct sockaddr *, socklen_t *));int sys_Egetsockname __P((int, struct sockaddr *, socklen_t *));ssize_t sys_Ereadv __P((int, const struct iovec *, int));int sys_Erecvfrom __P((int, void *, size_t, int, struct sockaddr *, size_t *));ssize_t sys_Erecvmsg __P((int, struct msghdr *, int));ssize_t sys_Esendmsg __P((int, const struct msghdr *, int));ssize_t sys_Ewritev __P((int, const struct iovec *, int));int sys_naccept __P((int, struct sockaddr *, socklen_t *));int sys_ngetpeername __P((int, struct sockaddr *, socklen_t *));int sys_ngetsockname __P((int, struct sockaddr *, socklen_t *));int sys_nrecvfrom __P((int, void *, size_t, int, struct sockaddr *, size_t *));ssize_t sys_nrecvmsg __P((int, struct msghdr *, int));ssize_t sys_nsendmsg __P((int, const struct msghdr *, int));#endif  /* HAVE_EXTRA_OSF_SYMBOLS */#endif /* SOCKSLIBRARY_DYNAMIC */__END_DECLS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -