privsock.h

説明を見る。
00001 #ifndef VSF_PRIVSOCK_H
00002 #define VSF_PRIVSOCK_H
00003 
00004 struct mystr;
00005 struct vsf_session;
00006 
00007 /* priv_sock_init()
00008  * PURPOSE
00009  * Initialize the priv_sock system, by opening the communications sockets.
00010  * PARAMETERS
00011  * p_sess       - the current session object
00012  */
00013 void priv_sock_init(struct vsf_session* p_sess);
00014 
00015 /* priv_sock_send_cmd()
00016  * PURPOSE
00017  * Sends a command, typically to the privileged side of the channel.
00018  * PARAMETERS
00019  * fd           - the fd on which to send the command
00020  * cmd          - the command to send
00021  */
00022 void priv_sock_send_cmd(int fd, char cmd);
00023 
00024 /* priv_sock_send_str()
00025  * PURPOSE
00026  * Sends a string to the other side of the channel.
00027  * PARAMETERS
00028  * fd           - the fd on which to send the string
00029  * p_str        - the string to send
00030  */
00031 void priv_sock_send_str(int fd, const struct mystr* p_str);
00032 
00033 /* priv_sock_get_result()
00034  * PURPOSE
00035  * Receives a response, typically from the privileged side of the channel.
00036  * PARAMETERS
00037  * fd           - the fd on which to receive the response
00038  * RETURNS
00039  * The response code.
00040  */
00041 char priv_sock_get_result(int fd);
00042 
00043 /* priv_sock_get_cmd()
00044  * PURPOSE
00045  * Receives a command, typically on the privileged side of the channel.
00046  * PARAMETERS
00047  * fd           - the fd on which to receive the command.
00048  * RETURNS
00049  * The command that was sent.
00050  */
00051 char priv_sock_get_cmd(int fd);
00052 
00053 /* priv_sock_get_str()
00054  * PURPOSE
00055  * Receives a string from the other side of the channel.
00056  * PARAMETERS
00057  * fd           - the fd on which to receive the string
00058  * p_dest       - where to copy the received string
00059  */
00060 void priv_sock_get_str(int fd, struct mystr* p_dest);
00061 
00062 /* priv_sock_send_result()
00063  * PURPOSE
00064  * Sends a command result, typically to the unprivileged side of the channel.
00065  * PARAMETERS
00066  * fd           - the fd on which to send the result
00067  * res          - the result to send
00068  */
00069 void priv_sock_send_result(int fd, char res);
00070 
00071 /* priv_sock_send_fd()
00072  * PURPOSE
00073  * Sends a file descriptor to the other side of the channel.
00074  * PARAMETERS
00075  * fd           - the fd on which to send the descriptor 
00076  * send_fd      - the descriptor to send
00077  */
00078 void priv_sock_send_fd(int fd, int send_fd);
00079 
00080 /* priv_sock_recv_fd()
00081  * PURPOSE
00082  * Receives a file descriptor from the other side of the channel.
00083  * PARAMETERS
00084  * fd           - the fd on which to receive the descriptor
00085  * RETURNS
00086  * The received file descriptor
00087  */
00088 int priv_sock_recv_fd(int fd);
00089 
00090 /* priv_sock_send_int()
00091  * PURPOSE
00092  * Sends an integer to the other side of the channel.
00093  * PARAMETERS
00094  * fd           - the fd on which to send the integer
00095  * the_int      - the integer to send
00096  */
00097 void priv_sock_send_int(int fd, int the_int);
00098 
00099 /* priv_sock_get_int()
00100  * PURPOSE
00101  * Receives an integer from the other side of the channel.
00102  * PARAMETERS
00103  * fd           - the fd on which to receive the integer
00104  * RETURNS
00105  * The integer that was sent.
00106  */
00107 int priv_sock_get_int(int fd);
00108 
00109 #define PRIV_SOCK_LOGIN             1
00110 #define PRIV_SOCK_CHOWN             2
00111 #define PRIV_SOCK_GET_DATA_SOCK     3
00112 #define PRIV_SOCK_GET_USER_CMD      4
00113 #define PRIV_SOCK_WRITE_USER_RESP   5
00114 
00115 #define PRIV_SOCK_RESULT_OK         1
00116 #define PRIV_SOCK_RESULT_BAD        2
00117 
00118 #endif /* VSF_PRIVSOCK_H */
00119 

Sat Aug 1 13:42:11 2009に生成されました。  doxygen 1.4.7