[PATCH 01 of 14 RFC c-hglib:level0] hg_handle:hg_header: typedef structures

Iulian Stana julian.stana at gmail.com
Tue Sep 3 15:30:40 CDT 2013


# 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;
+} 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


More information about the Mercurial-devel mailing list