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

📄 sockd.h

📁 sock protocol ,it is useful!
💻 H
📖 第 1 页 / 共 2 页
字号:
 * Calculates the number of free slots every child of type "type" has * combined.  If "type" is negated, the function instead returns * the total number of slots in every child. * If childcheck() is successful it also means there is at the minimum * one descriptor available. * Returns the total number of new objects children can accept. */intchildtype __P((pid_t pid));/* * Returns the type of child the child with pid "pid" is. */const char *childtype2string __P((int type));/* * returns the string representation of "type". */intremovechild __P((pid_t childpid));/* * Removes the child "child" with pid "childpid" and updates internal lists. * Returns: *		On success: 0 *		On failure: -1 (no current proxychild has pid "childpid".) */struct rule_t *addclientrule __P((const struct rule_t *rule));/* * Appends a copy of "rule" to our list of client rules. * Returns a pointer to the added rule (not "rule"). */struct rule_t *addsocksrule __P((const struct rule_t *rule));/* * Appends a copy of "rule" to our list of socks rules. * Returns a pointer to the added rule (not "rule"). */struct linkedname_t *adduser __P((struct linkedname_t **ruleuser, const char *name));/* * Adds a user with the name "name" to the list hanging of "ruleuser". * Returns: *		On success: a pointer ruleuser. *		On failure: NULL. */voidshowrule __P((const struct rule_t *rule));/* * prints the rule "rule". */voidshowclient __P((const struct rule_t *rule));/* * prints the clientrule "rule". */voidshowconfig __P((const struct config_t *config));/* * prints out config "config". */intrulespermit __P((int s, struct rule_t *rule,					  struct connectionstate_t *state,					  const struct sockshost_t *src, const struct sockshost_t *dst));/* * Checks whether the rules permit data from "src" to "dst". * "s" is the socket the connection is on.  "state" is the current * state of the connection and may be updated. * * Wildcard fields are supported for the following fields; *		ipv4:			INADDR_ANY *		port:			none [enum] * * "rule" is filled in with the contents of the matching rule. * Returns: *		True if a connection should be allowed. *		False otherwise. */intsockd_connect __P((int s, const struct sockshost_t *dst));/* * Tries to connect socket "s" to the host given in "dst". * Returns: *		On success: 0 *		On failure: -1 */voidresetconfig __P((void));/* * resets the current config back to default, freeing memory aswell. */voidsend_failure __P((int s, const struct response_t *response, int failure));/* * Sends a failure message to the client at "s".  "response" is the packet * we send, "failure" is the reason for failure and "auth" is the agreed on * authentication. */intsend_response __P((int s, const struct response_t *response));/* * Sends "response" to "s". *		On success: 0 *		On failure: -1 */intsend_req __P((int s, const struct sockd_request_t *req));/* * Sends "req" to "s". * Returns: *		On success: 0 *		On failure: -1 */intsend_client __P((int s, int client));/* * Sends the client "client" to "s". * Returns: *		On success: 0 *		On failure: -1 *//* * Returns a value indicating whether relaying from "src" to "dst" should * be permitted. */intselectmethod __P((const unsigned char *methodv, size_t methodc));/* * Selects the best method based on available methods and given * priority.  "methodv" is a list over available methods, methodc * in length. * The function returns the value of the method that should be selected, * AUTMETHOD_NOACCEPT if none is acceptable. */intmethod_uname __P((int s, struct request_t *request,						struct negotiate_state_t *state));/* * Enters username/password subnegotiation.  If successful, * "uname" is filled in with values read from client, if unsuccessful, * the contents of "uname" is indeterminate.  After negotiation has * finished and response to client is sent the function returns. * Returns: *		On success: 0 (user/password accepted) *		On failure: -1  (user/password not accepted, communication failure, *							  or something else.) */voidiolog __P((struct rule_t *rule, const struct connectionstate_t *state,		int operation,		const struct sockshost_t *src, const struct sockshost_t *dst,		const char *data, size_t count));/* * Called after each each complete io operation * (read then write, or read then block). * Does misc. logging based on the logoptions set in "log". * "rule" is the rule that matched the iooperation, not "const" due to * possible libwrap interaction. * "state" is the state of the connection. * "operation" is the operation that was performed. * "src" is where data was read from. * "dst" is where data was written to. * "data" and "count" are interpreted depending on "operation". * * If "operation" is *    OPERATION_ACCEPT *		OPERATION_CONNECT *    OPERATION_DISCONNECT *			"data" and "count" is ignored. * *		OPERATION_ABORT *		OPERATION_ERROR *			"count" is ignored. *			If "data" is not NULL, it is a string giving the reason for abort *			or error. *			If "data" is NULL, the reason is the errormessage affiliated *			with the current errno. * *		OPERATION_IO *			"data" is the data that was read and written. *			"count" is the number of bytes that was read/written. */intserverchild __P((int s, const struct sockaddr_in *local,					  const struct sockaddr_in *remote));/* * Forked off by the server after a connection has come in on "s" but * before any data has been read.  "local" is the address "remote" * connected to. * Returns: *		On success: 0 *		On failure : -1 */voidclose_iodescriptors __P((const struct sockd_io_t *io));/* * A subset of delete_io().  Will just close all descriptors in * "io". */intsockdnegotiate __P((int s));/* * Sends the connection "s" to a negotiator child. * Returns: *		On success: 0 *		On failure: -1 */voidrun_io __P((struct sockd_mother_t *mother));/* * Sets a io child running.  "mother" is the childs mother. * * A child starts running with zero clients and waits * indefinitely for mother to send atleast one. */voidrun_negotiate __P((struct sockd_mother_t *mother));/* * Sets a negotiator child running.  "mother" is the childs mother. * A child starts running with zero clients and waits * indefinitely for mother to send atleast one. */voidrun_request __P((struct sockd_mother_t *mother));/* * Sets a request child running.  "mother" is the childs mother. * "mread" is read connection to mother, "mwrite" is write connection. * A child starts running with zero clients and waits * indefinitely for mother to send atleast one. */intsend_io __P((int s, const struct sockd_io_t *io));/* * Tries to add send the io "io" to "s". * Returns *    On success: 0 *    On failure: -1 */intrecv_io __P((int mother, struct sockd_io_t *io));/* * Attempts to read a new io object from "mother". * If a io is received it is either copied into "io", or it's copied * to a internal list depending on if "io" is NULL or not;  thus mother * vs child semantics.  If semantics are those of a child, the request * field of "io" is sent to the controlconnection in "io". * Returns: *		On success: 0 *		On failure: -1 */intrecv_req __P((int s, struct sockd_request_t *req));/* * Receives a request from "s" and writes it to "req". * Returns: *		On success: 0 *		On failure: -1 */intrecv_request __P((int s, struct request_t *request,						struct negotiate_state_t *state));/* * Reads a socks request from the socket "s", which can be set to * non-blocking. * "request" will be filled in as reading progresses but it should * be considered of indeterminate contents untill the whole request * has been read. * Returns: *    On success: > 0 *    On failure: <= 0.  If errno does not indicate the request should be *                       be retried, the connection "s" should be dropped. */intrecv_sockspacket __P((int s, struct request_t *request,							 struct negotiate_state_t *state));/* * When methodnegotiation has finished (if appropriate) this function * is called to receive the actual packet. * Returns: *    On success: > 0 *    On failure: <= 0.  If errno does not indicate the request should be *                       be retried, the connection "s" should be dropped. */struct sockd_child_t *addchild __P((int type));/* * Adds a new child that can accept objects of type "type" from mother. * Returns: *    On success: a pointer to the added child. *    On failure: NULL.  (resource shortage.) */struct sockd_child_t *getchild __P((pid_t pid));/* * Attempts to find a child with pid "pid". * Returns: *		On success: a pointer to the found child. *		On failure: NULL. */voidsigchildbroadcast __P((int sig, int childtype));/* * Sends signal "sig" to all children of type "childtype". */intfillset __P((fd_set *set));/* * Sets every child's descriptor in "set", aswell as sockets we listen on. * Returns the number of the highest descriptor set, or -1 if none was set. */voidclearset __P((int type, const struct sockd_child_t *child, fd_set *set));/* * Clears every descriptor of type "type" in "child" from "set". * The values valid for "type" is SOCKD_NEWREQUEST or SOCKD_FREESLOT. */struct sockd_child_t *getset __P((int type, fd_set *set));/* * If there is a child with a descriptor set in "set", a pointer to * the child is returned.  "type" gives the type of descriptor that must * be set, either SOCKD_NEWREQUEST or SOCKD_FREESLOT. * The children returned are returned in prioritised order. * If no child is found, NULL is returned. */struct sockd_child_t *nextchild __P((int type));/* * Returns: *		On success: pointer to a child of correct type with atleast one free slot. *		On failure: NULL. */voidsetsockoptions(int s);/* * Sets options _all_ serversockets should have set. */voidsockdexit __P((int sig));/* * Called both by signal and manually. * If "sig" is less than 0, assume it's manually and exit with absolute * value of "sig". * Otherwise report exit due to signal "sig". */struct hostent *cgethostbyname __P((const char *name));/* * Identical to gethostbyname() but caches info. */struct hostent *cgethostbyaddr __P((const char *addr, int len, int type));/* * Identical to gethostbyaddr() but caches info. */voidsocks_seteuid __P((uid_t *old, uid_t new));/* * Sets euid to "new".  If "old" is not NULL, current euid is saved in it. * Exits on failure. */voidsocks_reseteuid __P((uid_t current, uid_t new));/* * "Resets" euid back from "current" to "new". * If the operation fails, it's flagged as an internal error. */intpasswordcheck __P((const char *name, const char *cleartextpassword));/* * Checks whether "name" is in the passwordfile. * If "cleartextpassword" is not NULL, also checks if "name"'s * password is "cleartextpassword". * * Returns: *		If "name" and "cleartextpassword" is matched: 0 *		If "name" is unknown: 1 *		If "cleartextpassword" does not match: 2 */#ifdef DEBUGvoidprintfd __P((const struct sockd_io_t *io, const char *prefix));/* * prints the contents of "io".  "prefix" is the string prepended * to the printing. (typically "received" or "sent".) */#endif__END_DECLS

⌨️ 快捷键说明

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