Remote and RPC.
[wrappi.git] / lib / proto-xdr.h
diff --git a/lib/proto-xdr.h b/lib/proto-xdr.h
new file mode 100644 (file)
index 0000000..a73fffb
--- /dev/null
@@ -0,0 +1,51 @@
+/* wrappi
+ * Copyright (C) 2011-2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PROTO_XDR_H_
+#define PROTO_XDR_H_
+
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+
+#define WRAP_INT_PROTO_MAGIC        0x57524150 /* 'W' 'R' 'A' 'P' */
+#define WRAP_INT_PROTOCOL           1
+#define WRAP_INT_PROTO_TYPE_REQUEST 1
+#define WRAP_INT_PROTO_TYPE_REPLY   2
+#define WRAP_INT_PROTO_TYPE_ERROR   3
+
+struct wrap_int_message_header {
+  uint32_t magic;               /* WRAP_INT_PROTO_MAGIC */
+  uint32_t protocol;            /* protocol version */
+  uint32_t serial;              /* message serial number */
+  char *proc;                   /* procedure name */
+  uint32_t type;                /* WRAP_INT_PROTO_TYPE_* */
+};
+
+struct wrap_int_message_error {
+  char *error_message;          /* error message */
+  char *error_errno;            /* errno as string, eg. "EINVAL", or empty */
+  char *error_func;             /* function where error occurred */
+};
+
+extern bool_t wrap_int_xdr_message_header (XDR *, struct wrap_int_message_header *);
+extern bool_t wrap_int_xdr_message_error (XDR *, struct wrap_int_message_error *);
+
+#endif /* WRAPPI_INTERNAL_H_ */