10 #include <netinet/in.h>
12 #define NSM2_PORT 8120
14 #define NSM2_MEMSIZ (4096*1024)
16 #define NSMENV_HOST "NSM2_HOST"
17 #define NSMENV_PORT "NSM2_PORT"
18 #define NSMENV_SHMKEY "NSM2_SHMKEY"
20 #define NSMDENV_USER "NSMD2_USER"
21 #define NSMDENV_GROUP "NSMD2_GROUP"
22 #define NSMDENV_DEBUG "NSMD2_DEBUG"
23 #define NSMDENV_LOGDIR "NSMD2_LOGDIR"
24 #define NSMDENV_PRIORITY "NSMD2_PRIORITY"
25 #define NSMDENV_TCPBUF "NSMD2_TCPBUF"
27 #ifndef __nsm2_typedef_nonstdint__
28 #define __nsm2_typedef_nonstdint__
29 typedef unsigned char byte8;
30 typedef unsigned short uint16;
31 typedef unsigned int uint32;
32 typedef unsigned long long uint64;
33 typedef signed short int16;
34 typedef signed int int32;
35 typedef signed long long int64;
38 #ifndef __nsm2_typedef_sockad__
39 #define __nsm2_typedef_sockad__
40 typedef struct sockaddr SOCKAD;
41 typedef struct sockaddr_in SOCKAD_IN;
44 #define NSMSYS_NAME_SIZ 31
45 #define NSMSYS_MAX_NOD 1024
46 #define NSMSYS_MAX_REF 4096
47 #define NSMSYS_MAX_REG 8192
48 #define NSMSYS_MAX_DAT 1024
49 #define NSMSYS_MAX_CON 1024
50 #define NSMSYS_MAX_REQ 1024
51 #define NSMSYS_MAX_HASH 2039
52 #define NSMSYS_MAX_SCH 256
53 #define NSMSYS_DNAM_SIZ 31
54 #define NSMSYS_DFMT_SIZ 63
55 #define NSMSYS_LOGDIR_SIZ 200
56 #define NSMSYS_LOGNAME_SIZ 256
62 #define NSM_MTUSIZ 1500
63 #define NSM_IPHEADSIZ 20
64 #define NSM_UDPHEADSIZ 8
65 #define NSM_UDPMSGSIZ 1472
66 #define NSM_UDPDATSIZ 1464
68 #define NSM_TCPHEADSIZ 16
69 #define NSM_TCPPARMAX 256
70 #define NSM_TCPDATSIZ 65536
71 #define NSM_TCPBUFSIZ (256*4 + NSM_TCPDATSIZ)
72 #define NSM_TCPMSGSIZ (16 + NSM_TCPBUFSIZ)
73 #define NSM_TCPTHRESHOLD (16 + 256*4)
75 #define NSM_DATCHUNKSIZ 1464
76 #define NSM_DATMAXCHUNK 44
77 #define NSM_DATMAXSIZ (NSM_DATCHUNKSIZ*NSM_DATMAXCHUNK)
79 #define NSMD_MAXINVFMT 32
80 #define NSMD_TIMINVFMT 3600
89 char dat[NSM_UDPDATSIZ];
124 #define NSMCMD_FIRST (0xff00)
125 #define NSMCMD_LAST (0xff1c)
127 #define NSMCMD_NEWCLIENT (NSMCMD_FIRST + 0x00)
128 #define NSMCMD_NEWCLIENTOB (NSMCMD_FIRST + 0x01)
129 #define NSMCMD_NEWMASTER (NSMCMD_FIRST + 0x02)
130 #define NSMCMD_DELCLIENT (NSMCMD_FIRST + 0x03)
131 #define NSMCMD_ALLOCMEM (NSMCMD_FIRST + 0x04)
132 #define NSMCMD_FREEMEM (NSMCMD_FIRST + 0x05)
133 #define NSMCMD_FLUSHMEM (NSMCMD_FIRST + 0x06)
134 #define NSMCMD_REQCPYMEM (NSMCMD_FIRST + 0x07)
135 #define NSMCMD_SYSCPYMEM (NSMCMD_FIRST + 0x08)
136 #define NSMCMD_OPENMEM (NSMCMD_FIRST + 0x09)
137 #define NSMCMD_CLOSEMEM (NSMCMD_FIRST + 0x0a)
138 #define NSMCMD_DUMPNODE (NSMCMD_FIRST + 0x0b)
139 #define NSMCMD_DUMPALLOC (NSMCMD_FIRST + 0x0c)
140 #define NSMCMD_DUMPDATA (NSMCMD_FIRST + 0x0d)
141 #define NSMCMD_DUMPCONN (NSMCMD_FIRST + 0x0e)
142 #define NSMCMD_DUMPINFO (NSMCMD_FIRST + 0x0f)
143 #define NSMCMD_DEBUGFLAG (NSMCMD_FIRST + 0x10)
144 #define NSMCMD_KILLDAEMON (NSMCMD_FIRST + 0x11)
145 #define NSMCMD_CLEANUP (NSMCMD_FIRST + 0x12)
146 #define NSMCMD_TOUCHMEM (NSMCMD_FIRST + 0x13)
147 #define NSMCMD_PING (NSMCMD_FIRST + 0x14)
148 #define NSMCMD_PONG (NSMCMD_FIRST + 0x15)
149 #define NSMCMD_READY (NSMCMD_FIRST + 0x16)
150 #define NSMCMD_NOP (NSMCMD_FIRST + 0x17)
151 #define NSMCMD_NEWREQ (NSMCMD_FIRST + 0x18)
152 #define NSMCMD_DELREQ (NSMCMD_FIRST + 0x19)
154 #define NSMCMD_UDPOFFSET (0xff00)
155 #define NSMCMD_NEWDAEMON (NSMCMD_FIRST + 0x1a)
156 #define NSMCMD_ACKDAEMON (NSMCMD_FIRST + 0x1b)
157 #define NSMCMD_USRCPYMEM (NSMCMD_FIRST + 0x1c)
161 char name[NSMSYS_NAME_SIZ + 1];
174 char name[NSMSYS_NAME_SIZ + 1];
194 char dtnam[NSMSYS_DNAM_SIZ + 1];
195 char dtfmt[NSMSYS_DFMT_SIZ + 1];
229 #define NSMCON_NON (-1)
277 char mem[NSM2_MEMSIZ];
287 int16_t sock_updated;
293 NSMnod nod[NSMSYS_MAX_NOD];
294 NSMref ref[NSMSYS_MAX_REF];
295 NSMdat dat[NSMSYS_MAX_DAT];
296 NSMreq req[NSMSYS_MAX_REQ];
297 NSMreg reg[NSMSYS_MAX_REG];
300 int32_t nodhash[NSMSYS_MAX_HASH + 1];
301 int32_t dathash[NSMSYS_MAX_HASH + 1];
302 int32_t reqhash[NSMSYS_MAX_HASH + 1];
304 NSMcon con[NSMSYS_MAX_CON];
305 NSMsch sch[NSMSYS_MAX_SCH];
308 int16_t conid[NSMSYS_MAX_NOD];
325 char logfile[NSMSYS_LOGNAME_SIZ];
338 char buf[NSM_TCPTHRESHOLD];