From 0419ab46455c597bea13725a02cd4567e30718d9 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Tue, 20 Dec 2016 21:46:39 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20de=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- man/communication.h.3 | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 man/communication.h.3 diff --git a/man/communication.h.3 b/man/communication.h.3 new file mode 100644 index 0000000..74b51ed --- /dev/null +++ b/man/communication.h.3 @@ -0,0 +1,57 @@ +.TH COMMUNICATION.H 3 2016-12-20 "" "Linux Programmer's Manual" +.SH NAME +communication.h \- all functions explained +.SH SYNOPSIS +.nf +.B #include +.sp +// SERVICE +.sp +.BI "int srv_init (int " argc ", char ** " argv ", char **" env ", struct service * " srv " +.BI " , const char * " service_name ); +.BI "int srv_accept (struct service * " srv ", struct process * " p ); +.sp +.BI "int srv_read (const struct process * " p ", char ** " buf ", size_t * " buf_size ); +.BI "int srv_write (const struct process * ", const char * " buf ", size_t " buf_size ); +.sp +.BI "int srv_close (struct service * " srv ); +.BI "int srv_close_proc (struct process * " p ); + +// APPLICATION + +// Initialize connection with unix socket +// send the connection string to $TMP/ +// fill srv->spath && srv->service_fd +.BI "int app_connection (int " argc ", char ** " argv ", char ** " env ", struct service * " srv +.BI " , const char * " service_name " +.BI " , const char * " connection_str ", size_t " connection_str_size ); +.sp +.BI "int app_read (struct service * " srv ", char ** " buf ", size_t * " msize ); +.BI "int app_write (struct service * " srv ", char * " buf ", size_t " msize ); +.sp +.BI "int app_close (struct service * " srv ); + + +.fi +.SH DESCRIPTION +The +.BR srv_init () +function let the service declare itself, create a new unix socket and listen. +.I argc +, +.IR argv +and +.IR env +should be passed to the function in order to automatically change the behavior of the program without the application being modified. \fBTODO\fR. + +.I *srv +is the pointer to the \fBstruct service\fR that should be filled (index and version parameters). +The \fBsrv_init()\fR function will fill the rest of the parameters of this structure, such as the unix socket path and the unix socket file descriptor in order to be able to receive new connections. +.PP +The +.BR srv_accept () +function accepts new connections. +.IR p +parameter is the client process that will be provided after the connection. +.SH RETURN VALUE +All the functions return an integer less than zero if there is an error.