Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2007 00:41:17 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 124331 for review
Message-ID:  <200707300041.l6U0fHUG004338@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124331

Change 124331 by gcooper@optimus-revised_pkgtools on 2007/07/30 00:41:05

	api.c -- rename function.
	api.h --
		1. rename function.
		2. whitespace.
		3. Add data types.
	client.c/server.c --
		Sketch in some functionality.

Affected files ...

.. //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/api.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/api.h#4 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/client.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/server.c#2 edit

Differences ...

==== //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/api.c#2 (text+ko) ====

@@ -1,7 +1,7 @@
 #include "lib/ipc/api.h"
 
 ipc_info_t *
-is_valid_ipc_message(char header, message_type_t message_type)
+parse_ipc_message(char header)
 {
 
     ipc_info_t *ipc_info = calloc(1, sizeof(ipc_info_t));

==== //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/api.h#4 (text+ko) ====

@@ -2,12 +2,19 @@
 
 #define __API_H
 
-typedef struct message_type_t {
+typedef enum {
     NULL_TYPE = 0,
     ORIGIN_TYPE,
     FILEDB_ENTRY_TYPE,
     PKGDB_ENTRY_TYPE
-};
+} message_type_e;
+
+typedef struct {
+    message_type_e message_type;
+    int valid;
+    int remove_entry;
+    int meta;
+} ipc_info_t;
 
 /**
  * The protocol consists of an 8-bit header and 1023 byte payload, devised as follows:
@@ -52,25 +59,28 @@
  *
  */
 
-#define IPC_MSG_TYPE_SHIFT	6
+#define IPC_MSG_TYPE_SHIFT      6
+
+#define IPC_MSG_PKGDB_TYPE      (3 << IPC_MSG_TYPE_SHIFT)
+#define IPC_MSG_FILEDB_TYPE     (2 << IPC_MSG_TYPE_SHIFT)
 
-#define IPC_MSG_PKGDB_TYPE	(3 << IPC_MSG_TYPE_SHIFT)
-#define IPC_MSG_FILEDB_TYPE	(2 << IPC_MSG_TYPE_SHIFT)
+#define IPC_MSG_DB_TYPE         (2 << IPC_MSG_TYPE_SHIFT)
 
-#define IPC_MSG_DB_TYPE		(2 << IPC_MSG_TYPE_SHIFT)
+#define IPC_MSG_ORIGIN_TYPE     (1 << IPC_MSG_TYPE_SHIFT)
 
-#define IPC_MSG_ORIGIN_TYPE	(1 << IPC_MSG_TYPE_SHIFT)
+#define IPC_MSG_UPDATE          (1 << 5)
 
-#define IPC_MSG_UPDATE		(1 << 5)
+#define IPC_MSG_REMOVE_ENTRY    (1 << 4)
 
-#define IPC_MSG_REMOVE_ENTRY	(1 << 4)
+#define IPC_MSG_IS_DEPORIGIN    (1 << 3)
 
-#define IPC_MSG_IS_DEPORIGIN	(1 << 3)
+#define IPC_MSG_VALID_FILE      (1 << 2)
 
-#define IPC_MSG_VALID_FILE	(1 << 2)
+#define IPC_MSG_VALID_CHECKSUM  (1 << 1)
 
-#define IPC_MSG_VALID_CHECKSUM	(1 << 1)
+#define IPC_VALID_MESSAGE       0
+#define IPC_INVALID_MESSAGE     1
 
-ipc_info_t	is_valid_ipc_message(char);
+ipc_info_t*	parse_ipc_message(char);
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/client.c#2 (text+ko) ====

@@ -1,0 +1,33 @@
+#include "lib/ipc/client.h"
+    
+int
+client_service_ipc_recv(int sock, ipc_info_t *ipc_info, char *msg)
+{
+
+    char *data_payload = (msg+1);
+
+    ipc_info = parse_ipc_message(*msg);
+
+    if(ipc_info->valid) {
+
+//	ipc_info->valid = 0;
+
+    }
+
+    return ipc_info->valid;
+
+}
+
+int
+client_service_ipc_send(int sock, ipc_info_t ipc_info, char *msg)
+{
+
+    if(ipc_info->valid) {
+
+//	ipc_info->valid = 0;
+
+    }
+
+    return (int) send(sock, req_string, sizeof(msg), MSG_OOB | MSG_EOF | MSG_NOSIGNAL);
+
+}

==== //depot/projects/soc2007/revised_fbsd_pkgtools/v2/lib/ipc/server.c#2 (text+ko) ====

@@ -1,0 +1,33 @@
+#include "lib/ipc/server.h"
+
+int
+server_service_ipc_recv(int sock, ipc_info_t *ipc_info, char *msg)
+{
+
+    char *data_payload = (msg+1);
+
+    ipc_info = parse_ipc_message(*msg);
+
+    if(ipc_info->valid) {
+
+//	ipc_info->valid = 0;
+
+    }
+
+    return ipc_info->valid;
+
+}
+
+int
+server_service_ipc_send(int sock, ipc_info_t ipc_info, char *msg)
+{
+
+    if(ipc_info->valid) {
+
+//	ipc_info->valid = 0;
+
+    }
+
+    return (int) send(sock, req_string, sizeof(msg), MSG_OOB | MSG_EOF | MSG_NOSIGNAL);
+
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707300041.l6U0fHUG004338>