Belle II Software
release-05-02-19
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
h
i
l
m
n
p
r
s
t
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
nsm2.h
1
#ifndef __nsm2_h__
2
#define __nsm2_h__
3
4
#if defined(__cplusplus)
5
extern
"C"
{
6
#endif
7
#if defined(__dummy_close_bracket_to_cheat_emacs_auto_indent)
8
}
9
#endif
10
11
/* -- version info */
12
13
#define NSM_REQUIRED_VERSION 1999
/* required version */
14
#define NSM_LIBRARY_VERSION 2003
/* library version */
15
#define NSM_PACKAGE_VERSION 2006
/* package version */
16
17
/*
18
20120723 1900 file created
19
20121115 1903 queue based message sending starts working
20
20121117 1904 queue based touchsys working for newclient
21
20121218 1905 fix delclient
22
(next is to implement hash)
23
20130116 1906 hash implemented
24
20130117 1907 hash fix1 (***hash not in network-byte order yet)
25
20130117 1908 hash fix (***hash in network-byte order)
26
20130219 1909 first version with usrcpymem (still many bugs)
27
20130303 1910 alpha version release candidate
28
20131218 1914 merged with Konno veresion
29
20131219 1915 uid/gid for MEM shm
30
20131222 1916 printlog infinite loop fix
31
20131229 1917 no change in nsmd2, update in nsminfo2 and b2lib
32
20131230 1918 libs: strerror fix, initnet fix, stdint fix, bridge fix
33
20140104 1919 b2libs: b2nsm_ok text, nsmd2: disid fix
34
20140105 1920 nsminfo2 from nsmd2
35
20140106 1921 destroyconn fix, etc
36
20140107 1922 fixing the case when both master/deputy are killed
37
20140107 1923 fixing priority passing
38
20140114 1924 rewrite of nsmd_do_newmaster
39
20140117 1924 nsmd2 check error before going background, many crucial bug
40
fixes on nsmd master/deputy switching, color nsminfo2
41
20140124 1925 anonymous node
42
20140304 1926 new parser, 20 byte smaller chunk size for IP header
43
20140305 1927 freeq fix for sending a long packet
44
20140305 1928 fix to 1927, DoS vulnerability test, still far from OK
45
20140306 1929 no fprintf for DoS vulnerability trial tests, in vain
46
20140306 1930 restore logfp and cleanup (but still write instead of fwrite)
47
20140516 1931 corelib: ip address from shm if not specified
48
20140614 1932 corelib: sprintf ip address if host is missing
49
20140614 1933 corelib: use nodhash for nsmlib_nodeid
50
20140902 1934 static bsizbuf pollution fix, broken tcprecv debug
51
20140902 1935 memset fix
52
20140903 1936 debug message fix
53
20140903 1937 nsmparse fix (see nsmparse.c)
54
20140917 1938 newclient error return fix / shm cleanup fix
55
20140917 1939 skip revision check by -1
56
20140921 1940 bytes in nsmparse_t, flushmem, less DBG in nsmd2
57
20140922 1941 nsmget is added
58
20140922 1942 nodtim fix
59
20150520 1943 destroyconn fix [for anonymous and for sys.ready]
60
20150521 1944 new protocol version, master reconnect fix
61
20150808 1945 updates for PNNL summer school tutorial
62
20160420 1946 suppress debug output of nsmd2 and b2lib
63
20170613 1947 nsmd2 update for USRCPYMEM protection
64
20180326 1959 based on 1947, just change the handling of -o option
65
20180327 1960 delconn/touchsys fix, better log, nsminfo2 hostname
66
20180328 1961 limit syscpymem.pos in uint16 range
67
20180329 1962 nsmlib.h fix for nsmlib_parsefile type
68
20180404 1963 nsminfo2 no hostname resolving by default
69
20180412 1964 one more nsminfo2 update on hostname cache
70
20180417 1965 suppress "bad" in usrcpymem if not ready
71
20180423 1966 destroyconn when write error at tcpwriteq
72
20180430 1967 src/dest at command and lastmsg at delconn for debug
73
20180502 1968 fix nsmd_dbg of 1967 printing all DBG messages
74
20180504 1969 b2nsm_nodename restored from 1957
75
20180515 1970 int16_t fix for owner in usrcpymem
76
20180519 1971 tcprecv static buffer shift upon delcon
77
20180521 1972 further debug of 1971
78
20180523 1973 nsminfo2 usage print
79
20180709 1974 nsmlib memory leak fix, etc, nsmd2 is rolled back to 1970
80
20180711 1975 nsmlib update again
81
20180801 1976 nsmd2 for better shm handling, b2nsm_term (experimental)
82
20180802 1977 example update, shmget fix, pipe close, USRCPYMEM delay
83
20180811 1978 fix prio, ready, forward, etc for master switch
84
20180815 1979 nsmd2 fix conid on master, nsminfo2 -X fix
85
20180815 1980 nsmd2 partial fix of node already exists
86
20180815 1981 nsmd2 hopefully final fix of node already exists
87
20180820 1982 nsmd2 kill HUP when connection is closed
88
20180820 1983 nsmd2 tcprecv local conid shift upon delcon, c++example added
89
20180822 1984 nsmd2 quick patch to avoid kill 0 HUP
90
20180823 1985 nsmd2 debug for tcprecv assert
91
20180824 1986 nsmd2 tcprecv debug continue, localtime => localtime_r
92
20180826 1987 nsmd2 tcprecv debug done, nsmd_localtime_r, verbose log
93
20180826 1988 nsmd2 code cleanup and suppress log for release version
94
20180902 1989 c++example fix, simplest.cc is added
95
20180927 1990 nsmd2 another orphan node fix, b2lib fixes
96
20181009 1991 restoring 1970 and cope with 1978 gen/prio fix
97
20181029 1992 double free bug fix
98
20181029 1993 experimental: do not die in do_delclient bad ip
99
20190415 1994 add: NSMESHMNOSYS, NSMESHMACCMEM, nsmc->errn
100
20190524 1994 mod: NSMENODEST, shm handling, nodeproc, makefile
101
20190524 1995 add: nsmstat2, fix: nsmd2 ocnt/osiz/otim
102
20190529 1994 fix: nsmlib2.c null sysp handling
103
20190529 1995 merge: fix in 1994
104
20190530 1996 fix: nsmd2 int function must always return (for g++ 8.2.0 -O)
105
20190724 1997 mod: version definition, nsminfo2 format, log filename
106
20190903 1998 fix: nsmd2 momentary deputy, select timeout in tcprecv
107
20190913 1999 mod: b2nsm_logging and b2nsm_context return previous value
108
20191002 1999 mod: nsmsys2.h should not be needed by user
109
20191123 1999 fix: nsm2sh send_vset
110
20200121 1999 fix: call destroyconn upon new re-accept
111
20200122 1999 fix: reuse tm in reopenlog
112
20200122 1999 fix: bad tcphead
113
20200127 2000 dbg: nsmstat2 crash
114
20200314 2001 dbg: nsmstat2 crash (32-bit host), add: localhost support
115
20200416 2002 add: killnsm2, mod: nsmd2.cc code cleanup
116
20200520 2003 fix: bad tcphead by newclient, avoid already exist error
117
20200520 2004 fix: close fd 0,1,2 before running in background
118
20200522 2005 fix: allow udp socket == 0, eliminate log at startup with -b
119
20200603 2006 fix: corelib nnod fix
120
*/
121
122
/* -- DATA TYPES ----------------------------------------------------- */
123
#ifndef __nsm2_typedef_nonstdint__
124
#define __nsm2_typedef_nonstdint__
125
#include "stdint.h"
126
typedef
uint8_t byte8;
127
typedef
uint16_t uint16;
128
typedef
uint32_t uint32;
129
typedef
uint64_t uint64;
130
typedef
int16_t int16;
131
typedef
int32_t int32;
132
typedef
int64_t int64;
133
#endif
/* nsm2_typedef_nonstdint */
134
135
#ifndef __nsm2_typedef_context__
136
#define __nsm2_typedef_context__
137
struct
NSMcontext_struct
;
138
typedef
struct
NSMcontext_struct
NSMcontext
;
139
#endif
/* nsm2_typedef_context */
140
141
/* request offset */
142
#define NSMREQ_FIRST (0x1000)
143
144
/* no error */
145
#define NSMENOERR (0)
146
147
/* unexpected system or internal errors */
148
#define NSMEALLOC (-101)
149
#define NSMESOCKET (-102)
150
#define NSMESOCKDGRAM (-103)
151
#define NSMEGIFCONF (-104)
152
#define NSMEGIFFLAGS (-105)
153
#define NSMESOCKREUSE (-106)
154
#define NSMESOCKSNDBUF (-107)
155
#define NSMESOCKRCVBUF (-108)
156
#define NSMERDSELECT (-109)
157
#define NSMERDUID (-110)
158
#define NSMENOPIPE (-111)
159
#define NSMESELECT (-112)
160
#define NSMETIMEOUT (-113)
161
#define NSMEWRITE (-114)
162
#define NSMECLOSED (-115)
163
#define NSMEPIPEREAD (-116)
164
#define NSMEPIPEWRITE (-117)
165
/* #define NSMEMAXRETRY (-118) */
166
#define NSMEDATID (-118)
167
#define NSMEUNEXPECTED (-119)
168
169
/* possible errors by user parameters */
170
#define NSMENOMASTER (-1)
/* there is no master nsmd yet */
171
#define NSMEINVNAME (-2)
/* invalid name (length or character) */
172
#define NSMEINVPAR (-3)
/* invalid parameter(s) */
173
#define NSMENODEEXIST (-4)
/* node already exist */
174
#define NSMEFULNODE (-5)
/* no more NSM node */
175
#define NSMENODEST (-6)
/* destination node does not exist */
176
#define NSMEINVFMT (-7)
/* invalid data format */
177
#define NSMEMEMEXIST (-8)
/* data already exists */
178
#define NSMENOMOREMEM (-9)
/* no more data area */
179
#define NSMEOPENED (-10)
/* already opened */
180
#define NSMENODENAME (-11)
181
#define NSMENODELONG (-12)
182
#define NSMEHOSTNAME (-13)
183
#define NSMEALREADYP (-14)
184
#define NSMEALREADYS (-15)
185
#define NSMEALREADYH (-16)
186
#define NSMENOIF (-17)
187
#define NSMENONSMD (-18)
188
#define NSMENOUID (-19)
189
#define NSMERDCLOSE (-20)
190
#define NSMEACCESS (-21)
191
#define NSMESHMGETSYS (-22)
192
#define NSMESHMATSYS (-23)
193
#define NSMESHMGETMEM (-24)
194
#define NSMESHMATMEM (-25)
195
#define NSMENOINIT (-26)
196
#define NSMEPERM (-27)
/* anonymous node can't send */
197
#define NSMEINVDATA (-28)
/* len==0 xor data==0 */
198
#define NSMEINVFUNC (-29)
199
#define NSMEMAXFUNC (-30)
200
#define NSMENOMEM (-31)
/* data does not exist (openmem) */
201
#define NSMEBADFMT (-32)
/* data format is inconsistent (openmem) */
202
#define NSMEBADREV (-33)
/* data revision is inconsistent (openmem) */
203
#define NSMEPARSE (-34)
/* data format parse error (openmem) */
204
#define NSMECONNECT (-35)
/* connection error */
205
#define NSMEINVPTR (-36)
/* invalid data pointer */
206
#define NSMESHMNOSYS (-37)
/* ESHMGETSYS and ENOENT */
207
#define NSMESHMACCES (-38)
/* ESHMGETMEM and EACCES */
208
#define NSMEEMPTYDEST (-39)
/* empty string for destination node */
209
#define NSMENGMASTER (-40)
/* master nsmd2 temporarily unreachable */
210
#define NSMETIMEOUTW (-41)
/* timeout in sending to nsmd2 */
211
#define NSMETIMEOUTR (-42)
/* timeout in receiving from nsmd2 */
212
#define NSMENOSUCHREQ (-43)
/* no such registered request */
213
#define NSMEBADHASH (-44)
/* broken internal hash table */
214
#define NSMENODEHERE (-45)
/* node already exist on the same host */
215
216
/* NSMmsg (in host byte order) */
217
typedef
struct
{
218
uint16_t req;
219
uint16_t seq;
220
int16_t node;
/* source/destination nodeid, or (-1) if not an NSM client */
221
uint8_t npar;
222
uint16_t len;
223
int32_t pars[256];
/* signed */
224
const
char
* datap;
225
}
NSMmsg
;
226
227
typedef
void (*NSMcallback_t)(
NSMmsg
* msg,
NSMcontext
* nsmc);
228
typedef
void (*NSMfunc_t)(
NSMmsg
* msg,
NSMcontext
* nsmc);
229
230
#if defined(__dummy_open_bracket_to_cheat_emacs_auto_indent)
231
__dummy_open_bracket_to_cheat_emacs_auto_indent {
232
#endif
233
#if defined(__cplusplus)
234
}
235
#endif
236
237
#endif
/* __nsm2_h__ */
238
239
/* -- (emacs outline mode setup) ------------------------------------- */
240
/*
241
// Local Variables: ***
242
// mode:outline-minor ***
243
// outline-regexp:"^/\\* --[+ ]" ***
244
// End: ***
245
*/
NSMmsg
Definition:
nsm2.h:217
NSMcontext_struct
Definition:
nsmlib2.h:66
daq
slc
nsm2
corelib
nsm2.h
Generated on Tue Jan 4 2022 02:54:26 for Belle II Software by
1.8.17