#ifndef XMON_PROTO_H #define XMON_PROTO_H #define XM_STATUS_OK 0 #define XM_STATUS_ERR 1 #define XM_ERR_WRONGVER 0 /* Version mismatch */ #define XM_ERR_UNKNOWNOP 1 /* Unknown operation */ #define XM_ERR_FAULT 2 /* Server fault */ #define XM_VERSION 0 #define XM_OP_SYSINFO 0 #define XM_MAGIC 0x504A4238 #define XM_REQUEST 0 #define XM_REPLY 1 #define XM_SYSINFO_UPTIME 0x0001 #define XM_SYSINFO_LOAD1 0x0002 #define XM_SYSINFO_LOAD5 0x0004 #define XM_SYSINFO_LOAD15 0x0008 #define XM_SYSINFO_TOTALRAM 0x0010 #define XM_SYSINFO_FREERAM 0x0020 #define XM_SYSINFO_SHAREDRAM 0x0040 #define XM_SYSINFO_BUFFERRAM 0x0080 #define XM_SYSINFO_TOTALSWAP 0x0100 #define XM_SYSINFO_FREESWAP 0x0200 #define XM_SYSINFO_PROCS 0x0400 #define XM_SYSINFO_ALLFLAGS 0x07FF struct request { int32_t xid; uint32_t magic; uint32_t calltype; uint32_t version; uint32_t opcode; /* no data at present */ }; struct reply_err { uint32_t reason; }; struct reply_sysinfo { uint32_t flags; uint32_t uptime; uint32_t loads[3]; uint32_t totalram, freeram, sharedram, bufferram; uint32_t totalswap, freeswap; uint32_t procs; }; struct reply { int32_t xid; uint32_t magic; uint32_t calltype; uint32_t status; uint32_t opcode; union { struct reply_err err; struct reply_sysinfo sysinfo; } t; }; #endif