18#include <netinet/in.h>
22#define NSM2_MEMSIZ (4096*1024)
24#define NSMENV_HOST "NSM2_HOST"
25#define NSMENV_PORT "NSM2_PORT"
26#define NSMENV_SHMKEY "NSM2_SHMKEY"
28#define NSMDENV_USER "NSMD2_USER"
29#define NSMDENV_GROUP "NSMD2_GROUP"
30#define NSMDENV_DEBUG "NSMD2_DEBUG"
31#define NSMDENV_LOGDIR "NSMD2_LOGDIR"
32#define NSMDENV_PRIORITY "NSMD2_PRIORITY"
33#define NSMDENV_TCPBUF "NSMD2_TCPBUF"
35#ifndef __nsm2_typedef_nonstdint__
36#define __nsm2_typedef_nonstdint__
37typedef unsigned char byte8;
38typedef unsigned short uint16;
39typedef unsigned int uint32;
40typedef unsigned long long uint64;
41typedef signed short int16;
42typedef signed int int32;
43typedef signed long long int64;
46#ifndef __nsm2_typedef_sockad__
47#define __nsm2_typedef_sockad__
48typedef struct sockaddr SOCKAD;
49typedef struct sockaddr_in SOCKAD_IN;
52#define NSMSYS_NAME_SIZ 31
53#define NSMSYS_MAX_NOD 1024
54#define NSMSYS_MAX_REF 4096
55#define NSMSYS_MAX_REG 8192
56#define NSMSYS_MAX_DAT 1024
57#define NSMSYS_MAX_CON 1024
58#define NSMSYS_MAX_REQ 1024
59#define NSMSYS_MAX_HASH 2039
60#define NSMSYS_MAX_SCH 256
61#define NSMSYS_DNAM_SIZ 31
62#define NSMSYS_DFMT_SIZ 63
63#define NSMSYS_LOGDIR_SIZ 200
64#define NSMSYS_LOGNAME_SIZ 256
70#define NSM_MTUSIZ 1500
71#define NSM_IPHEADSIZ 20
72#define NSM_UDPHEADSIZ 8
73#define NSM_UDPMSGSIZ 1472
74#define NSM_UDPDATSIZ 1464
76#define NSM_TCPHEADSIZ 16
77#define NSM_TCPPARMAX 256
78#define NSM_TCPDATSIZ 65536
79#define NSM_TCPBUFSIZ (256*4 + NSM_TCPDATSIZ)
80#define NSM_TCPMSGSIZ (16 + NSM_TCPBUFSIZ)
81#define NSM_TCPTHRESHOLD (16 + 256*4)
83#define NSM_DATCHUNKSIZ 1464
84#define NSM_DATMAXCHUNK 44
85#define NSM_DATMAXSIZ (NSM_DATCHUNKSIZ*NSM_DATMAXCHUNK)
87#define NSMD_MAXINVFMT 32
88#define NSMD_TIMINVFMT 3600
97 char dat[NSM_UDPDATSIZ];
132#define NSMCMD_FIRST (0xff00)
133#define NSMCMD_LAST (0xff1c)
135#define NSMCMD_NEWCLIENT (NSMCMD_FIRST + 0x00)
136#define NSMCMD_NEWCLIENTOB (NSMCMD_FIRST + 0x01)
137#define NSMCMD_NEWMASTER (NSMCMD_FIRST + 0x02)
138#define NSMCMD_DELCLIENT (NSMCMD_FIRST + 0x03)
139#define NSMCMD_ALLOCMEM (NSMCMD_FIRST + 0x04)
140#define NSMCMD_FREEMEM (NSMCMD_FIRST + 0x05)
141#define NSMCMD_FLUSHMEM (NSMCMD_FIRST + 0x06)
142#define NSMCMD_REQCPYMEM (NSMCMD_FIRST + 0x07)
143#define NSMCMD_SYSCPYMEM (NSMCMD_FIRST + 0x08)
144#define NSMCMD_OPENMEM (NSMCMD_FIRST + 0x09)
145#define NSMCMD_CLOSEMEM (NSMCMD_FIRST + 0x0a)
146#define NSMCMD_DUMPNODE (NSMCMD_FIRST + 0x0b)
147#define NSMCMD_DUMPALLOC (NSMCMD_FIRST + 0x0c)
148#define NSMCMD_DUMPDATA (NSMCMD_FIRST + 0x0d)
149#define NSMCMD_DUMPCONN (NSMCMD_FIRST + 0x0e)
150#define NSMCMD_DUMPINFO (NSMCMD_FIRST + 0x0f)
151#define NSMCMD_DEBUGFLAG (NSMCMD_FIRST + 0x10)
152#define NSMCMD_KILLDAEMON (NSMCMD_FIRST + 0x11)
153#define NSMCMD_CLEANUP (NSMCMD_FIRST + 0x12)
154#define NSMCMD_TOUCHMEM (NSMCMD_FIRST + 0x13)
155#define NSMCMD_PING (NSMCMD_FIRST + 0x14)
156#define NSMCMD_PONG (NSMCMD_FIRST + 0x15)
157#define NSMCMD_READY (NSMCMD_FIRST + 0x16)
158#define NSMCMD_NOP (NSMCMD_FIRST + 0x17)
159#define NSMCMD_NEWREQ (NSMCMD_FIRST + 0x18)
160#define NSMCMD_DELREQ (NSMCMD_FIRST + 0x19)
162#define NSMCMD_UDPOFFSET (0xff00)
163#define NSMCMD_NEWDAEMON (NSMCMD_FIRST + 0x1a)
164#define NSMCMD_ACKDAEMON (NSMCMD_FIRST + 0x1b)
165#define NSMCMD_USRCPYMEM (NSMCMD_FIRST + 0x1c)
169 char name[NSMSYS_NAME_SIZ + 1];
182 char name[NSMSYS_NAME_SIZ + 1];
202 char dtnam[NSMSYS_DNAM_SIZ + 1];
203 char dtfmt[NSMSYS_DFMT_SIZ + 1];
237#define NSMCON_NON (-1)
285 char mem[NSM2_MEMSIZ];
296 int16_t sock_updated;
304 NSMnod nod[NSMSYS_MAX_NOD];
305 NSMref ref[NSMSYS_MAX_REF];
306 NSMdat dat[NSMSYS_MAX_DAT];
307 NSMreq req[NSMSYS_MAX_REQ];
308 NSMreg reg[NSMSYS_MAX_REG];
311 int32_t nodhash[NSMSYS_MAX_HASH + 1];
312 int32_t dathash[NSMSYS_MAX_HASH + 1];
313 int32_t reqhash[NSMSYS_MAX_HASH + 1];
316 NSMcon con[NSMSYS_MAX_CON];
317 NSMsch sch[NSMSYS_MAX_SCH];
320 int16_t conid[NSMSYS_MAX_NOD];
338 char logfile[NSMSYS_LOGNAME_SIZ];
351 char buf[NSM_TCPTHRESHOLD];