00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _MESH_IPC_H_
00036 #define _MESH_IPC_H_
00037
00038 #ifdef MESH_IPC_SERVER
00039 # include <syslog.h>
00040
00041 # define p_error(k, f) do { \
00042 syslog(LOG_ERR, "%s: %s: %m", k, f); \
00043 } while (0);
00044
00045 # define h_error(k, f) do { \
00046 syslog(LOG_ERR, "%s: %s: %s", k, f, hstrerror(h_errno)); \
00047 } while (0);
00048
00049 #else // not MESH_IPC_SERVER
00050 # define MESH_LIBRARY "libsensormesh"
00051
00052 # define p_error(k, f) do { \
00053 fprintf(stderr, "%s %s: %s: %s.\n", \
00054 MESH_LIBRARY, k, f, strerror(errno)); \
00055 } while (0);
00056
00057 # define h_error(k, f) do { \
00058 fprintf(stderr, "%s %s: %s: %s.\n", \
00059 MESH_LIBRARY, k, f, hstrerror(h_errno)); \
00060 } while (0);
00061
00062 #endif // MESH_IPC_SERVER
00063
00064 #define MESH_CONTROL_PORT 1007
00065
00069 #define MESH_IOREDISCVR 0x8300
00070 #define MESH_IOGSNDQ 0x8301
00071 #define MESH_IOSSNDQ 0x8302
00072 #define MESH_IOGMTU 0x8303
00073 #define MESH_IOSMTU 0x8304
00074 #define MESH_IOGSNDTMO 0x8305
00075 #define MESH_IOSSNDTMO 0x8306
00076 #define MESH_IOGRTMTR 0x8307
00077 #define MESH_IOGLNKMTR 0x8308
00078 #define MESH_IOGNGHADDR 0x8309
00079 #define MESH_IOGNGHPOS 0x8310
00080 #define MESH_IOSOCKET 0x8311
00081 #define MESH_IOSENDSEQ 0x8312
00082 #define MESH_IORECVSEQ 0x8313
00083 #define MESH_IOSENDRAW 0x8314
00084 #define MESH_IORECVRAW 0x8315
00085 #define MESH_IOSENDNEAR 0x8316
00086 #define MESH_IORECVNEAR 0x8317
00087
00088
00089 #ifdef MESH_IPC_SERVER
00090
00091 struct _self;
00092 int mesh_ioserv(struct _self *self);
00093
00094 #else
00095
00096 int mesh_ipc_init(void);
00097 int mesh_ioctl(int request, ...);
00098
00099 #endif
00100
00101
00102 #endif // _MESH_IPC_H_