Submitter | Iulian Stana |
---|---|
Date | Sept. 3, 2013, 8:30 p.m. |
Message ID | <589054a6400c09ea6130.1378240240@doppler> |
Download | mbox | patch |
Permalink | /patch/2306/ |
State | Deferred, archived |
Headers | show |
Comments
:::: # HG changeset patch :::: # User Iulian Stana <julian.stana at gmail.com> :::: # Date 1378233008 -10800 :::: # Tue Sep 03 21:30:08 2013 +0300 :::: # Node ID 589054a6400c09ea613043d6529b526897ac8515 :::: # Parent 0000000000000000000000000000000000000000 :::: hg_handle:hg_header: typedef structures :::: :::: diff --git a/client.h b/client.h :::: new file mode 100644 :::: --- /dev/null :::: +++ b/client.h :::: @@ -0,0 +1,53 @@ :::: +#ifndef _CLIENT_H_ :::: +#define _CLIENT_H_ :::: + :::: +#include <errno.h> :::: +#include <stdint.h> :::: +#include <sys/types.h> :::: + :::: + :::: +/** :::: + * \struct hg_header :::: + * \brief This structure contains the variables for the header. :::: + * :::: + * \var hg_header::channel :::: + * The channel will stock a letter that will indicate the type of channel. :::: + * \var hg_header::length :::: + * The length will stock the size of data that will be send or the maxim data :::: + * that can be received by the server. :::: + * :::: + * */ :::: +typedef struct hg_header{ :::: + uint32_t length; :::: + char channel; Again, I rebounce Kevin's comment from Aug 6th, http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/62348/focus=62498 Kevin: :::: I'd rather see some constants or an enum for the channel. :::: Not sure what the current C best practice is, but I :::: don't think it's "dump the raw char into a struct field". Please Iulian do that. Also, do not forget this requirement from Matt: :::: Make sure your code is -ignoring- any lowercase channels it doesn't know about. :::: +} hg_header; :::: + :::: +/** :::: + * \struct hg_handle :::: + * \brief This structure will be use to handle the connection with the server. :::: + * :::: + * \var hg_handle::p_read Read file description that will read from cmdsrv. :::: + * \var hg_handle::p_write Write file description that will write to cmdsrv. :::: + * \var hg_handle::childpid :::: + * The pid of the process that will open the connection with cmdsrv. :::: + * \var hg_handle::header :::: + * The header that will contain the current header-action(channel, length). :::: + * Through this header, the user will know on what channel the server will :::: + * send his data. :::: + * \var hg_handle::protect :::: + * Create a protection mechanism to block calling rawcommand(new hg :::: + * command) until the exitcode for the last command is not received. :::: + */ :::: +typedef struct hg_handle{ :::: + pid_t childpid; :::: + hg_header next_header; :::: + hg_header current_header; :::: + int p_read; :::: + int p_write; :::: + int protect; :::: + :::: + int out_data_size; :::: + char *out_data; :::: +} hg_handle; :::: + :::: +#endif
Patch
diff --git a/client.h b/client.h new file mode 100644 --- /dev/null +++ b/client.h @@ -0,0 +1,53 @@ +#ifndef _CLIENT_H_ +#define _CLIENT_H_ + +#include <errno.h> +#include <stdint.h> +#include <sys/types.h> + + +/** + * \struct hg_header + * \brief This structure contains the variables for the header. + * + * \var hg_header::channel + * The channel will stock a letter that will indicate the type of channel. + * \var hg_header::length + * The length will stock the size of data that will be send or the maxim data + * that can be received by the server. + * + * */ +typedef struct hg_header{ + uint32_t length; + char channel; +} hg_header; + +/** + * \struct hg_handle + * \brief This structure will be use to handle the connection with the server. + * + * \var hg_handle::p_read Read file description that will read from cmdsrv. + * \var hg_handle::p_write Write file description that will write to cmdsrv. + * \var hg_handle::childpid + * The pid of the process that will open the connection with cmdsrv. + * \var hg_handle::header + * The header that will contain the current header-action(channel, length). + * Through this header, the user will know on what channel the server will + * send his data. + * \var hg_handle::protect + * Create a protection mechanism to block calling rawcommand(new hg + * command) until the exitcode for the last command is not received. + */ +typedef struct hg_handle{ + pid_t childpid; + hg_header next_header; + hg_header current_header; + int p_read; + int p_write; + int protect; + + int out_data_size; + char *out_data; +} hg_handle; + +#endif