Merge lp:~info-martin-konrad/epics-gateway/putlog into lp:~epics-core/epics-gateway/original-trunk
- putlog
- Merge into original-trunk
Status: | Merged |
---|---|
Approved by: | Ralph Lange |
Approved revision: | 183 |
Merged at revision: | 182 |
Proposed branch: | lp:~info-martin-konrad/epics-gateway/putlog |
Merge into: | lp:~epics-core/epics-gateway/original-trunk |
Diff against target: |
531 lines (+328/-1) 7 files modified
Makefile (+9/-0) gateResources.cc (+222/-0) gateResources.h (+17/-0) gateStat.cc (+9/-0) gateStat.h (+2/-0) gateVc.cc (+18/-0) gateway.cc (+51/-1) |
To merge this branch: | bzr merge lp:~info-martin-konrad/epics-gateway/putlog |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ralph Lange | Approve | ||
Ben Franksen | Pending | ||
Review via email: mp+213921@code.launchpad.net |
Commit message
Description of the change
Add option to compile in and use caPutLog
Ralph Lange (ralph-lange) wrote : | # |
- 182. By Martin Konrad
-
Add debug output for CAPUTLOG to Makefile
- 183. By Martin Konrad
-
Set USR_* instead of USR_*_DEFAULT if CAPUTLOG is defined
This makes sure these settings are added even if USR_*_<os> has
been defined.
Ben Franksen (bfrk) wrote : | # |
Am Donnerstag, 15. Mai 2014, 07:23:18 schrieb Ralph Lange:
> Review: Approve close look at the code, no testing
>
> To me, this patch looks good.
>
> I have not settled in well enough to have an environment to actually compile
> and test the code, though, so I would like Benjamin to also have a look and
> maybe take this for a test drive.
Sorry for not answering sooner, I was extremely busy with a side project of
mine...
Looking at https:/
I have the feeling what the page shows me is not the whole change. For
instance, I am not seeing any caPutLog includes being added. Or maybe I see
only the latest change on the branch and not the whole diff? How can I see
that?
BTW, is there a way to look at differences side-by-side in launchpad?
Sorry for my stupidity w.r.t. lp UI
Ben
_______
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
Martin Konrad (info-martin-konrad) wrote : | # |
Hi Ben,
> Looking at
> https:/
>I have the feeling what the page shows me is not the whole change.
> For instance, I am not seeing any caPutLog includes being added.
Have a look at gateResources.cc lines 36 to 39.
> Or maybe I see only the latest change on the branch and not the whole
> diff? How can I see that?
Nope, there are 3 commits on this branch. One adds the new code and two
fix minor issues (I pushed them an hour ago). The merge view shows the
changes introduced by all three commits.
> Sorry for my stupidity w.r.t. lp UI
Sorry, cannot comment on that. LP is not for me either...
Martin
--
Martin Konrad
Control System Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: <email address hidden>
Ben Franksen (bfrk) wrote : | # |
Am Montag, 19. Mai 2014, 19:21:21 schrieb Martin Konrad:
> > Looking at
> > https:/
> > /213921>
> >I have the feeling what the page shows me is not the whole change.
> >
> > For instance, I am not seeing any caPutLog includes being added.
>
> Have a look at gateResources.cc lines 36 to 39.
Oops. Like I said, just stupidity on my side...
> > Or maybe I see only the latest change on the branch and not the whole
> > diff? How can I see that?
>
> Nope, there are 3 commits on this branch. One adds the new code and two
> fix minor issues (I pushed them an hour ago). The merge view shows the
> changes introduced by all three commits.
Thanks, I hoped that was the case.
So. I've taken a close look and it all looks pretty neat and tidy to me and
gets my full approval, as far as I am able to judge (disclaimer: I am not
deeply familiar with the gateway code).
Cheers
Ben
--
Perl: There Is More Than One Way To Do It
Python: There Is One Way To Do It
Haskell: There Is One Way To Do It, Up To Isomorphisµ
_______
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
Ralph Lange (ralph-lange) wrote : | # |
Finally I was able to compile and run a few tests.
Looks good!
Martin Konrad (info-martin-konrad) wrote : | # |
> The proposal to merge lp:~info-martin-konrad/epics-gateway/putlog into lp:epics-gateway has been updated.
>
> Status: Approved => Merged
Ralph, are you planning to celebrate this with a new release?
--
Martin Konrad
Control System Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: <email address hidden>
Preview Diff
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2009-09-17 15:45:45 +0000 | |||
3 | +++ Makefile 2014-05-19 18:31:22 +0000 | |||
4 | @@ -144,6 +144,14 @@ | |||
5 | 144 | # need access to casCtx.h | 144 | # need access to casCtx.h |
6 | 145 | USR_INCLUDES += -I$(EPICS_BASE)/src/cas/generic | 145 | USR_INCLUDES += -I$(EPICS_BASE)/src/cas/generic |
7 | 146 | 146 | ||
8 | 147 | # To compile in caPutLog functionality, define the location of the caPutLog | ||
9 | 148 | # module as 'CAPUTLOG' in the appropriate extensions configure/RELEASE* file | ||
10 | 149 | ifdef CAPUTLOG | ||
11 | 150 | USR_LIBS += caPutLog dbIoc | ||
12 | 151 | USR_CXXFLAGS += -DWITH_CAPUTLOG | ||
13 | 152 | USR_CFLAGS += -DWITH_CAPUTLOG | ||
14 | 153 | endif | ||
15 | 154 | |||
16 | 147 | PROD_HOST = gateway | 155 | PROD_HOST = gateway |
17 | 148 | 156 | ||
18 | 149 | 157 | ||
19 | @@ -179,6 +187,7 @@ | |||
20 | 179 | @echo ACC_SFLAGS_NO: $(ACC_SFLAGS_NO) | 187 | @echo ACC_SFLAGS_NO: $(ACC_SFLAGS_NO) |
21 | 180 | @echo SHARED_LIBRARIES: $(SHARED_LIBRARIES) | 188 | @echo SHARED_LIBRARIES: $(SHARED_LIBRARIES) |
22 | 181 | @echo DEBUGCMD: $(DEBUGCMD) | 189 | @echo DEBUGCMD: $(DEBUGCMD) |
23 | 190 | @echo CAPUTLOG: $(CAPUTLOG) | ||
24 | 182 | 191 | ||
25 | 183 | # **************************** Emacs Editing Sequences ***************** | 192 | # **************************** Emacs Editing Sequences ***************** |
26 | 184 | # Local Variables: | 193 | # Local Variables: |
27 | 185 | 194 | ||
28 | === modified file 'gateResources.cc' | |||
29 | --- gateResources.cc 2011-04-05 21:28:22 +0000 | |||
30 | +++ gateResources.cc 2014-05-19 18:31:22 +0000 | |||
31 | @@ -41,6 +41,12 @@ | |||
32 | 41 | #include <gddAppTable.h> | 41 | #include <gddAppTable.h> |
33 | 42 | #include <dbMapper.h> | 42 | #include <dbMapper.h> |
34 | 43 | 43 | ||
35 | 44 | #ifdef WITH_CAPUTLOG | ||
36 | 45 | #include <caPutLog.h> | ||
37 | 46 | #include <caPutLogTask.h> | ||
38 | 47 | #include <caPutLogAs.h> | ||
39 | 48 | #endif | ||
40 | 49 | |||
41 | 44 | // Global variables | 50 | // Global variables |
42 | 45 | gateResources* global_resources; | 51 | gateResources* global_resources; |
43 | 46 | 52 | ||
44 | @@ -108,6 +114,159 @@ | |||
45 | 108 | return name; | 114 | return name; |
46 | 109 | } | 115 | } |
47 | 110 | 116 | ||
48 | 117 | #ifdef WITH_CAPUTLOG | ||
49 | 118 | /* | ||
50 | 119 | We need to define these here, as caPutLog is using dbFldTypes.h defs for | ||
51 | 120 | DBR_xxx and our code is loading db_access.h defs elsewhere, and thse ARE | ||
52 | 121 | DIFFERENT. | ||
53 | 122 | |||
54 | 123 | DBR_FLOAT in db_access.h is 6, for example but in dbFldTypes.h that means a | ||
55 | 124 | DBR_ULONG. | ||
56 | 125 | */ | ||
57 | 126 | #define OUR_DBR_STRING 0 | ||
58 | 127 | #define OUR_DBR_CHAR 1 | ||
59 | 128 | #define OUR_DBR_UCHAR 2 | ||
60 | 129 | #define OUR_DBR_SHORT 3 | ||
61 | 130 | #define OUR_DBR_USHORT 4 | ||
62 | 131 | #define OUR_DBR_LONG 5 | ||
63 | 132 | #define OUR_DBR_ULONG 6 | ||
64 | 133 | #define OUR_DBR_FLOAT 7 | ||
65 | 134 | #define OUR_DBR_DOUBLE 8 | ||
66 | 135 | |||
67 | 136 | static int gddGetOurType(const gdd *gddVal) | ||
68 | 137 | { | ||
69 | 138 | switch ( gddVal->primitiveType() ) { | ||
70 | 139 | case aitEnumInt8 : return(OUR_DBR_CHAR); | ||
71 | 140 | case aitEnumUint8 : return(OUR_DBR_UCHAR); | ||
72 | 141 | case aitEnumInt16 : return(OUR_DBR_SHORT); | ||
73 | 142 | case aitEnumEnum16 : return(OUR_DBR_USHORT); | ||
74 | 143 | case aitEnumUint16 : return(OUR_DBR_USHORT); | ||
75 | 144 | case aitEnumInt32 : return(OUR_DBR_LONG); | ||
76 | 145 | case aitEnumUint32 : return(OUR_DBR_ULONG); | ||
77 | 146 | case aitEnumFloat32 : return(OUR_DBR_FLOAT); | ||
78 | 147 | case aitEnumFloat64 : return(OUR_DBR_DOUBLE); | ||
79 | 148 | case aitEnumFixedString: | ||
80 | 149 | case aitEnumString: | ||
81 | 150 | default: | ||
82 | 151 | return(OUR_DBR_STRING); | ||
83 | 152 | } | ||
84 | 153 | } | ||
85 | 154 | |||
86 | 155 | static int gddToVALUE(const gdd *gddVal, short ourdbrtype, VALUE *valueStruct) | ||
87 | 156 | { | ||
88 | 157 | memset(valueStruct,0,sizeof(VALUE)); | ||
89 | 158 | switch (ourdbrtype) { | ||
90 | 159 | case OUR_DBR_CHAR: { | ||
91 | 160 | aitInt8 x; | ||
92 | 161 | gddVal->get(x); | ||
93 | 162 | valueStruct->v_char = x; | ||
94 | 163 | } | ||
95 | 164 | return(0); | ||
96 | 165 | |||
97 | 166 | case OUR_DBR_UCHAR: { | ||
98 | 167 | aitUint8 x; | ||
99 | 168 | gddVal->get(x); | ||
100 | 169 | valueStruct->v_uchar = x; | ||
101 | 170 | } | ||
102 | 171 | return(0); | ||
103 | 172 | |||
104 | 173 | case OUR_DBR_SHORT: { | ||
105 | 174 | aitInt16 x; | ||
106 | 175 | gddVal->get(x); | ||
107 | 176 | valueStruct->v_short = x; | ||
108 | 177 | } | ||
109 | 178 | return(0); | ||
110 | 179 | |||
111 | 180 | case OUR_DBR_USHORT: { | ||
112 | 181 | aitUint16 x; | ||
113 | 182 | gddVal->get(x); | ||
114 | 183 | valueStruct->v_ushort = x; | ||
115 | 184 | } | ||
116 | 185 | return(0); | ||
117 | 186 | |||
118 | 187 | case OUR_DBR_LONG: { | ||
119 | 188 | aitInt32 x; | ||
120 | 189 | gddVal->get(x); | ||
121 | 190 | valueStruct->v_long = x; | ||
122 | 191 | } | ||
123 | 192 | return(0); | ||
124 | 193 | |||
125 | 194 | case OUR_DBR_ULONG: { | ||
126 | 195 | aitUint32 x; | ||
127 | 196 | gddVal->get(x); | ||
128 | 197 | valueStruct->v_ulong = x; | ||
129 | 198 | } | ||
130 | 199 | return(0); | ||
131 | 200 | |||
132 | 201 | case OUR_DBR_FLOAT: { | ||
133 | 202 | aitFloat32 x; | ||
134 | 203 | gddVal->get(x); | ||
135 | 204 | valueStruct->v_float = x; | ||
136 | 205 | } | ||
137 | 206 | return(0); | ||
138 | 207 | |||
139 | 208 | case OUR_DBR_DOUBLE: { | ||
140 | 209 | aitFloat64 x; | ||
141 | 210 | gddVal->get(x); | ||
142 | 211 | valueStruct->v_double = x; | ||
143 | 212 | } | ||
144 | 213 | return(0); | ||
145 | 214 | |||
146 | 215 | case OUR_DBR_STRING: | ||
147 | 216 | default: { | ||
148 | 217 | aitString x; | ||
149 | 218 | gddVal->get(x); | ||
150 | 219 | int len = strlen(x); | ||
151 | 220 | int siz = sizeof(valueStruct->v_string); | ||
152 | 221 | if (len >= siz) { | ||
153 | 222 | strncpy(valueStruct->v_string,x,siz-1); | ||
154 | 223 | valueStruct->v_string[siz-1] = 0; | ||
155 | 224 | } else { | ||
156 | 225 | strcpy(valueStruct->v_string,x); | ||
157 | 226 | } | ||
158 | 227 | return(0); | ||
159 | 228 | } | ||
160 | 229 | } | ||
161 | 230 | } | ||
162 | 231 | |||
163 | 232 | static char *debugVALUEString(VALUE *v, int ourdbrtype, char *buffer) | ||
164 | 233 | { | ||
165 | 234 | switch (ourdbrtype) { | ||
166 | 235 | case OUR_DBR_CHAR: | ||
167 | 236 | sprintf(buffer,"v_char %d",v->v_char); | ||
168 | 237 | break; | ||
169 | 238 | case OUR_DBR_UCHAR: | ||
170 | 239 | sprintf(buffer,"v_uchar %d",v->v_uchar); | ||
171 | 240 | break; | ||
172 | 241 | case OUR_DBR_SHORT: | ||
173 | 242 | sprintf(buffer,"v_short %hd",v->v_short); | ||
174 | 243 | break; | ||
175 | 244 | case OUR_DBR_USHORT: | ||
176 | 245 | sprintf(buffer,"v_ushort %hu",v->v_ushort); | ||
177 | 246 | break; | ||
178 | 247 | case OUR_DBR_LONG: | ||
179 | 248 | sprintf(buffer,"v_long %ld",v->v_long); | ||
180 | 249 | break; | ||
181 | 250 | case OUR_DBR_ULONG: | ||
182 | 251 | sprintf(buffer,"v_ulong %lu",v->v_ulong); | ||
183 | 252 | break; | ||
184 | 253 | case OUR_DBR_FLOAT: | ||
185 | 254 | sprintf(buffer,"v_float %g",v->v_float); | ||
186 | 255 | break; | ||
187 | 256 | case OUR_DBR_DOUBLE: | ||
188 | 257 | sprintf(buffer,"v_double %g",v->v_double); | ||
189 | 258 | break; | ||
190 | 259 | case OUR_DBR_STRING: | ||
191 | 260 | sprintf(buffer,"v_string '%s'",v->v_string); | ||
192 | 261 | break; | ||
193 | 262 | default: | ||
194 | 263 | sprintf(buffer,"unknown type %d",ourdbrtype); | ||
195 | 264 | } | ||
196 | 265 | return(buffer); | ||
197 | 266 | } | ||
198 | 267 | |||
199 | 268 | #endif // WITH_CAPUTLOG | ||
200 | 269 | |||
201 | 111 | gateResources::gateResources(void) | 270 | gateResources::gateResources(void) |
202 | 112 | { | 271 | { |
203 | 113 | as = NULL; | 272 | as = NULL; |
204 | @@ -130,6 +289,9 @@ | |||
205 | 130 | 289 | ||
206 | 131 | // Miscellaneous initializations | 290 | // Miscellaneous initializations |
207 | 132 | putlog_file=NULL; | 291 | putlog_file=NULL; |
208 | 292 | #ifdef WITH_CAPUTLOG | ||
209 | 293 | caputlog_address=NULL; | ||
210 | 294 | #endif | ||
211 | 133 | putlogFp=NULL; | 295 | putlogFp=NULL; |
212 | 134 | report_file=strDup(GATE_REPORT_FILE); | 296 | report_file=strDup(GATE_REPORT_FILE); |
213 | 135 | debug_level=0; | 297 | debug_level=0; |
214 | @@ -168,6 +330,10 @@ | |||
215 | 168 | if(command_file) delete [] command_file; | 330 | if(command_file) delete [] command_file; |
216 | 169 | if(putlog_file) delete [] putlog_file; | 331 | if(putlog_file) delete [] putlog_file; |
217 | 170 | if(report_file) delete [] report_file; | 332 | if(report_file) delete [] report_file; |
218 | 333 | #ifdef WITH_CAPUTLOG | ||
219 | 334 | caPutLog_Term(); | ||
220 | 335 | if (caputlog_address) delete [] caputlog_address; | ||
221 | 336 | #endif | ||
222 | 171 | } | 337 | } |
223 | 172 | 338 | ||
224 | 173 | int gateResources::appValue=0; | 339 | int gateResources::appValue=0; |
225 | @@ -207,6 +373,62 @@ | |||
226 | 207 | return 0; | 373 | return 0; |
227 | 208 | } | 374 | } |
228 | 209 | 375 | ||
229 | 376 | #ifdef WITH_CAPUTLOG | ||
230 | 377 | int gateResources::setCaPutlogAddress(const char* address) | ||
231 | 378 | { | ||
232 | 379 | if (caputlog_address) { | ||
233 | 380 | delete [] caputlog_address; | ||
234 | 381 | } | ||
235 | 382 | caputlog_address = strDup(address); | ||
236 | 383 | return 0; | ||
237 | 384 | } | ||
238 | 385 | |||
239 | 386 | int gateResources::caPutLog_Init(void) | ||
240 | 387 | { | ||
241 | 388 | if (caputlog_address) { | ||
242 | 389 | return caPutLogInit(caputlog_address,caPutLogAll); | ||
243 | 390 | } | ||
244 | 391 | return 1; | ||
245 | 392 | } | ||
246 | 393 | |||
247 | 394 | void gateResources::caPutLog_Term(void) | ||
248 | 395 | { | ||
249 | 396 | caPutLogTaskStop(); | ||
250 | 397 | } | ||
251 | 398 | |||
252 | 399 | void gateResources::caPutLog_Send | ||
253 | 400 | (const char *user, | ||
254 | 401 | const char *host, | ||
255 | 402 | const char *pvname, | ||
256 | 403 | const gdd *old_value, | ||
257 | 404 | const gdd *new_value) | ||
258 | 405 | { | ||
259 | 406 | if ((! new_value) || (new_value->primitiveType() == aitEnumInvalid)) return; | ||
260 | 407 | |||
261 | 408 | // get memory for a LOGDATA item from caPutLog's free list | ||
262 | 409 | LOGDATA *pdata = caPutLogDataCalloc(); | ||
263 | 410 | if (pdata == NULL) { | ||
264 | 411 | errlogPrintf("gateResources::caPutLogSend: memory allocation failed\n"); | ||
265 | 412 | return; | ||
266 | 413 | } | ||
267 | 414 | strcpy(pdata->userid,user); | ||
268 | 415 | strcpy(pdata->hostid,host); | ||
269 | 416 | strcpy(pdata->pv_name,pvname); | ||
270 | 417 | pdata->pfield = (void *) pvname; | ||
271 | 418 | pdata->type = gddGetOurType(new_value); | ||
272 | 419 | gddToVALUE(new_value,pdata->type,&pdata->new_value.value); | ||
273 | 420 | new_value->getTimeStamp(&pdata->new_value.time); | ||
274 | 421 | if ((old_value) && (old_value->primitiveType() != aitEnumInvalid) && (gddGetOurType(old_value) == pdata->type)) { | ||
275 | 422 | gddToVALUE(old_value,pdata->type,&pdata->old_value); | ||
276 | 423 | } else { | ||
277 | 424 | // if no usable old_value provided, fill in data.old_value with copy of new value | ||
278 | 425 | // as there's no way to flag a VALUE struct as invalid | ||
279 | 426 | memcpy(&pdata->old_value,&pdata->new_value.value,sizeof(VALUE)); | ||
280 | 427 | } | ||
281 | 428 | caPutLogTaskSend(pdata); | ||
282 | 429 | } | ||
283 | 430 | #endif // WITH_CAPUTLOG | ||
284 | 431 | |||
285 | 210 | int gateResources::setReportFile(const char* file) | 432 | int gateResources::setReportFile(const char* file) |
286 | 211 | { | 433 | { |
287 | 212 | if(report_file) delete [] report_file; | 434 | if(report_file) delete [] report_file; |
288 | 213 | 435 | ||
289 | === modified file 'gateResources.h' | |||
290 | --- gateResources.h 2007-07-10 20:08:21 +0000 | |||
291 | +++ gateResources.h 2014-05-19 18:31:22 +0000 | |||
292 | @@ -49,6 +49,7 @@ | |||
293 | 49 | #endif | 49 | #endif |
294 | 50 | 50 | ||
295 | 51 | #include "cadef.h" | 51 | #include "cadef.h" |
296 | 52 | #include "gdd.h" | ||
297 | 52 | 53 | ||
298 | 53 | #include "gateVersion.h" | 54 | #include "gateVersion.h" |
299 | 54 | 55 | ||
300 | @@ -132,6 +133,19 @@ | |||
301 | 132 | gateAs* getAs(void); | 133 | gateAs* getAs(void); |
302 | 133 | bool isAsSetUp(void) const { return as?true:false; } | 134 | bool isAsSetUp(void) const { return as?true:false; } |
303 | 134 | 135 | ||
304 | 136 | #ifdef WITH_CAPUTLOG | ||
305 | 137 | int setCaPutlogAddress(const char* address); | ||
306 | 138 | const char* caputlogAddress(void) const { return caputlog_address?caputlog_address:"NULL"; } | ||
307 | 139 | int hasCaPutlogAddress(void) const { return caputlog_address?1:0; } | ||
308 | 140 | int caPutLog_Init(void); | ||
309 | 141 | void caPutLog_Send(const char *user, | ||
310 | 142 | const char *host, | ||
311 | 143 | const char *pvname, | ||
312 | 144 | const gdd *old_value, | ||
313 | 145 | const gdd *new_value); | ||
314 | 146 | void caPutLog_Term(void); | ||
315 | 147 | #endif | ||
316 | 148 | |||
317 | 135 | // here for convenience | 149 | // here for convenience |
318 | 136 | static int appValue; | 150 | static int appValue; |
319 | 137 | static int appEnum; | 151 | static int appEnum; |
320 | @@ -144,6 +158,9 @@ | |||
321 | 144 | 158 | ||
322 | 145 | private: | 159 | private: |
323 | 146 | char *access_file, *pvlist_file, *command_file, *putlog_file, *report_file; | 160 | char *access_file, *pvlist_file, *command_file, *putlog_file, *report_file; |
324 | 161 | #ifdef WITH_CAPUTLOG | ||
325 | 162 | char *caputlog_address; | ||
326 | 163 | #endif | ||
327 | 147 | int debug_level, ro; | 164 | int debug_level, ro; |
328 | 148 | bool serverMode; | 165 | bool serverMode; |
329 | 149 | bool cacheMode; | 166 | bool cacheMode; |
330 | 150 | 167 | ||
331 | === modified file 'gateStat.cc' | |||
332 | --- gateStat.cc 2005-02-11 22:55:10 +0000 | |||
333 | +++ gateStat.cc 2014-05-19 18:31:22 +0000 | |||
334 | @@ -92,6 +92,15 @@ | |||
335 | 92 | pStat && pStat->getName()?pStat->getName():"Unknown"); | 92 | pStat && pStat->getName()?pStat->getName():"Unknown"); |
336 | 93 | fflush(fp); | 93 | fflush(fp); |
337 | 94 | } | 94 | } |
338 | 95 | #ifdef WITH_CAPUTLOG | ||
339 | 96 | if (global_resources->hasCaPutlogAddress()) { | ||
340 | 97 | global_resources->caPutLog_Send(asclient->user() ? asclient->user() : "Unknown", | ||
341 | 98 | asclient->host() ? asclient->host() : "Unknown", | ||
342 | 99 | (pStat && pStat->getName()) ? pStat->getName() : "Unknown", | ||
343 | 100 | (pStat) ? pStat->pvData() : NULL, | ||
344 | 101 | &value); | ||
345 | 102 | } | ||
346 | 103 | #endif | ||
347 | 95 | } | 104 | } |
348 | 96 | 105 | ||
349 | 97 | // Call the non-virtual-function write() in the gateStat | 106 | // Call the non-virtual-function write() in the gateStat |
350 | 98 | 107 | ||
351 | === modified file 'gateStat.h' | |||
352 | --- gateStat.h 2004-06-11 15:29:57 +0000 | |||
353 | +++ gateStat.h 2014-05-19 18:31:22 +0000 | |||
354 | @@ -78,6 +78,8 @@ | |||
355 | 78 | 78 | ||
356 | 79 | void report(FILE *fp); | 79 | void report(FILE *fp); |
357 | 80 | 80 | ||
358 | 81 | gdd* pvData(void) const { return value; } | ||
359 | 82 | |||
360 | 81 | protected: | 83 | protected: |
361 | 82 | gdd *value; | 84 | gdd *value; |
362 | 83 | gdd *attr; | 85 | gdd *attr; |
363 | 84 | 86 | ||
364 | === modified file 'gateVc.cc' | |||
365 | --- gateVc.cc 2009-08-31 19:57:25 +0000 | |||
366 | +++ gateVc.cc 2014-05-19 18:31:22 +0000 | |||
367 | @@ -244,6 +244,15 @@ | |||
368 | 244 | vc && vc->getName()?vc->getName():"Unknown"); | 244 | vc && vc->getName()?vc->getName():"Unknown"); |
369 | 245 | fflush(fp); | 245 | fflush(fp); |
370 | 246 | } | 246 | } |
371 | 247 | #ifdef WITH_CAPUTLOG | ||
372 | 248 | if (global_resources->hasCaPutlogAddress()) { | ||
373 | 249 | global_resources->caPutLog_Send(user ? user : "Unknown", | ||
374 | 250 | host ? host : "Unknown", | ||
375 | 251 | (vc && vc->getName()) ? vc->getName() : "Unknown", | ||
376 | 252 | (vc) ? vc->eventData() : NULL, | ||
377 | 253 | &value); | ||
378 | 254 | } | ||
379 | 255 | #endif | ||
380 | 247 | } | 256 | } |
381 | 248 | 257 | ||
382 | 249 | // Call the non-virtual-function write() in the gateVcData | 258 | // Call the non-virtual-function write() in the gateVcData |
383 | @@ -271,6 +280,15 @@ | |||
384 | 271 | vc && vc->getName()?vc->getName():"Unknown"); | 280 | vc && vc->getName()?vc->getName():"Unknown"); |
385 | 272 | fflush(fp); | 281 | fflush(fp); |
386 | 273 | } | 282 | } |
387 | 283 | #ifdef WITH_CAPUTLOG | ||
388 | 284 | if (global_resources->hasCaPutlogAddress()) { | ||
389 | 285 | global_resources->caPutLog_Send(user ? user : "Unknown", | ||
390 | 286 | host ? host : "Unknown", | ||
391 | 287 | (vc && vc->getName()) ? vc->getName() : "Unknown", | ||
392 | 288 | (vc) ? vc->eventData() : NULL, | ||
393 | 289 | &value); | ||
394 | 290 | } | ||
395 | 291 | #endif | ||
396 | 274 | } | 292 | } |
397 | 275 | 293 | ||
398 | 276 | // Call the non-virtual-function write() in the gateVcData | 294 | // Call the non-virtual-function write() in the gateVcData |
399 | 277 | 295 | ||
400 | === modified file 'gateway.cc' | |||
401 | --- gateway.cc 2007-07-10 20:08:21 +0000 | |||
402 | +++ gateway.cc 2014-05-19 18:31:22 +0000 | |||
403 | @@ -102,6 +102,7 @@ | |||
404 | 102 | // -access file_name = access security file | 102 | // -access file_name = access security file |
405 | 103 | // -command file_name = USR1 command list file | 103 | // -command file_name = USR1 command list file |
406 | 104 | // -putlog file_name = putlog file | 104 | // -putlog file_name = putlog file |
407 | 105 | // -caputlog = address (IP:port) for caPutLog server | ||
408 | 105 | // -report file_name = report file | 106 | // -report file_name = report file |
409 | 106 | // -home directory = the program's home directory | 107 | // -home directory = the program's home directory |
410 | 107 | // -connect_timeout number = clear PV connect requests every number seconds | 108 | // -connect_timeout number = clear PV connect requests every number seconds |
411 | @@ -123,6 +124,7 @@ | |||
412 | 123 | // process variable list file = gateway.pvlist | 124 | // process variable list file = gateway.pvlist |
413 | 124 | // USR1 command list file = gateway.command | 125 | // USR1 command list file = gateway.command |
414 | 125 | // putlog file = gateway.putlog | 126 | // putlog file = gateway.putlog |
415 | 127 | // caputlog address = none, not used | ||
416 | 126 | // report file = gateway.report | 128 | // report file = gateway.report |
417 | 127 | // log file = gateway.log | 129 | // log file = gateway.log |
418 | 128 | // debug level = 0 (none) | 130 | // debug level = 0 (none) |
419 | @@ -166,7 +168,9 @@ | |||
420 | 166 | #define PARM_SERVER_IGNORE_IP 25 | 168 | #define PARM_SERVER_IGNORE_IP 25 |
421 | 167 | #define PARM_CACHE 26 | 169 | #define PARM_CACHE 26 |
422 | 168 | #define PARM_ARCHIVE 27 | 170 | #define PARM_ARCHIVE 27 |
424 | 169 | 171 | #ifdef WITH_CAPUTLOG | |
425 | 172 | #define PARM_CAPUTLOG 28 | ||
426 | 173 | #endif | ||
427 | 170 | 174 | ||
428 | 171 | #define HOME_DIR_SIZE 300 | 175 | #define HOME_DIR_SIZE 300 |
429 | 172 | 176 | ||
430 | @@ -184,6 +188,9 @@ | |||
431 | 184 | static const char *log_file=NULL; | 188 | static const char *log_file=NULL; |
432 | 185 | static const char *putlog_file=NULL; | 189 | static const char *putlog_file=NULL; |
433 | 186 | static const char *report_file=NULL; | 190 | static const char *report_file=NULL; |
434 | 191 | #ifdef WITH_CAPUTLOG | ||
435 | 192 | static const char *caputlog_address=NULL; | ||
436 | 193 | #endif | ||
437 | 187 | #ifndef WIN32 | 194 | #ifndef WIN32 |
438 | 188 | static pid_t parent_pid; | 195 | static pid_t parent_pid; |
439 | 189 | #endif | 196 | #endif |
440 | @@ -205,6 +212,9 @@ | |||
441 | 205 | { "-access", 7, PARM_ACCESS, "file_name" }, | 212 | { "-access", 7, PARM_ACCESS, "file_name" }, |
442 | 206 | { "-command", 8, PARM_COMMAND, "file_name" }, | 213 | { "-command", 8, PARM_COMMAND, "file_name" }, |
443 | 207 | { "-putlog", 7, PARM_PUTLOG, "file_name" }, | 214 | { "-putlog", 7, PARM_PUTLOG, "file_name" }, |
444 | 215 | #ifdef WITH_CAPUTLOG | ||
445 | 216 | { "-caputlog", 9, PARM_CAPUTLOG, "address (ip:port)" }, | ||
446 | 217 | #endif | ||
447 | 208 | { "-report", 7, PARM_REPORT, "file_name" }, | 218 | { "-report", 7, PARM_REPORT, "file_name" }, |
448 | 209 | { "-home", 5, PARM_HOME, "directory" }, | 219 | { "-home", 5, PARM_HOME, "directory" }, |
449 | 210 | { "-sip", 4, PARM_SERVER_IP, "IP_address" }, | 220 | { "-sip", 4, PARM_SERVER_IP, "IP_address" }, |
450 | @@ -423,6 +433,9 @@ | |||
451 | 423 | fprintf(fp,"# pvlist file=<%s>\n",global_resources->listFile()); | 433 | fprintf(fp,"# pvlist file=<%s>\n",global_resources->listFile()); |
452 | 424 | fprintf(fp,"# command file=<%s>\n",global_resources->commandFile()); | 434 | fprintf(fp,"# command file=<%s>\n",global_resources->commandFile()); |
453 | 425 | fprintf(fp,"# putlog file=<%s>\n",global_resources->putlogFile()); | 435 | fprintf(fp,"# putlog file=<%s>\n",global_resources->putlogFile()); |
454 | 436 | #ifdef WITH_CAPUTLOG | ||
455 | 437 | fprintf(fp,"# caputlog address=<%s>\n",global_resources->caputlogAddress()); | ||
456 | 438 | #endif | ||
457 | 426 | fprintf(fp,"# report file=<%s>\n",global_resources->reportFile()); | 439 | fprintf(fp,"# report file=<%s>\n",global_resources->reportFile()); |
458 | 427 | fprintf(fp,"# debug level=%d\n",global_resources->debugLevel()); | 440 | fprintf(fp,"# debug level=%d\n",global_resources->debugLevel()); |
459 | 428 | fprintf(fp,"# dead timeout=%ld\n",global_resources->deadTimeout()); | 441 | fprintf(fp,"# dead timeout=%ld\n",global_resources->deadTimeout()); |
460 | @@ -622,6 +635,22 @@ | |||
461 | 622 | system("printenv | grep EPICS"); | 635 | system("printenv | grep EPICS"); |
462 | 623 | fflush(stdout); fflush(stderr); | 636 | fflush(stdout); fflush(stderr); |
463 | 624 | #endif | 637 | #endif |
464 | 638 | // start caPutLog in global_resources, if user defined a caPutLog ip:port address | ||
465 | 639 | #ifdef WITH_CAPUTLOG | ||
466 | 640 | if (global_resources->hasCaPutlogAddress()) { | ||
467 | 641 | int caputlog_status = global_resources->caPutLog_Init(); | ||
468 | 642 | if (caputlog_status != 0) { | ||
469 | 643 | fprintf(stderr,"%s global_resources caPutLogInit failed, aborting\n",timeStamp()); | ||
470 | 644 | fflush(stdout); | ||
471 | 645 | fflush(stderr); | ||
472 | 646 | if (server) { | ||
473 | 647 | delete server; | ||
474 | 648 | server = NULL; | ||
475 | 649 | } | ||
476 | 650 | return 1; | ||
477 | 651 | } | ||
478 | 652 | } | ||
479 | 653 | #endif | ||
480 | 625 | 654 | ||
481 | 626 | // Start the gateServer | 655 | // Start the gateServer |
482 | 627 | try { | 656 | try { |
483 | @@ -834,6 +863,18 @@ | |||
484 | 834 | } | 863 | } |
485 | 835 | } | 864 | } |
486 | 836 | break; | 865 | break; |
487 | 866 | #ifdef WITH_CAPUTLOG | ||
488 | 867 | case PARM_CAPUTLOG: | ||
489 | 868 | if(++i>=argc) no_error=0; | ||
490 | 869 | else { | ||
491 | 870 | if(argv[i][0]=='-') no_error=0; | ||
492 | 871 | else { | ||
493 | 872 | caputlog_address=argv[i]; | ||
494 | 873 | not_done=0; | ||
495 | 874 | } | ||
496 | 875 | } | ||
497 | 876 | break; | ||
498 | 877 | #endif | ||
499 | 837 | case PARM_REPORT: | 878 | case PARM_REPORT: |
500 | 838 | if(++i>=argc) no_error=0; | 879 | if(++i>=argc) no_error=0; |
501 | 839 | else { | 880 | else { |
502 | @@ -1062,6 +1103,9 @@ | |||
503 | 1062 | fprintf(stderr,"\tpvlist=%s\n",gr->listFile()); | 1103 | fprintf(stderr,"\tpvlist=%s\n",gr->listFile()); |
504 | 1063 | fprintf(stderr,"\tcommand=%s\n",gr->commandFile()); | 1104 | fprintf(stderr,"\tcommand=%s\n",gr->commandFile()); |
505 | 1064 | fprintf(stderr,"\tputlog=%s\n",gr->putlogFile()); | 1105 | fprintf(stderr,"\tputlog=%s\n",gr->putlogFile()); |
506 | 1106 | #ifdef WITH_CAPUTLOG | ||
507 | 1107 | fprintf(stderr,"\tcaputlog=%s\n",gr->caputlogAddress()); | ||
508 | 1108 | #endif | ||
509 | 1065 | fprintf(stderr,"\treport=%s\n",gr->reportFile()); | 1109 | fprintf(stderr,"\treport=%s\n",gr->reportFile()); |
510 | 1066 | fprintf(stderr,"\tdead=%ld\n",gr->deadTimeout()); | 1110 | fprintf(stderr,"\tdead=%ld\n",gr->deadTimeout()); |
511 | 1067 | fprintf(stderr,"\tconnect=%ld\n",gr->connectTimeout()); | 1111 | fprintf(stderr,"\tconnect=%ld\n",gr->connectTimeout()); |
512 | @@ -1113,6 +1157,9 @@ | |||
513 | 1113 | if(pvlist_file) gr->setListFile(pvlist_file); | 1157 | if(pvlist_file) gr->setListFile(pvlist_file); |
514 | 1114 | if(command_file) gr->setCommandFile(command_file); | 1158 | if(command_file) gr->setCommandFile(command_file); |
515 | 1115 | if(putlog_file) gr->setPutlogFile(putlog_file); | 1159 | if(putlog_file) gr->setPutlogFile(putlog_file); |
516 | 1160 | #ifdef WITH_CAPUTLOG | ||
517 | 1161 | if(caputlog_address) gr->setCaPutlogAddress(caputlog_address); | ||
518 | 1162 | #endif | ||
519 | 1116 | if(report_file) gr->setReportFile(report_file); | 1163 | if(report_file) gr->setReportFile(report_file); |
520 | 1117 | 1164 | ||
521 | 1118 | //set caching and archive mode | 1165 | //set caching and archive mode |
522 | @@ -1263,6 +1310,9 @@ | |||
523 | 1263 | fprintf(stderr," list file = <%s>\n",gr->listFile()); | 1310 | fprintf(stderr," list file = <%s>\n",gr->listFile()); |
524 | 1264 | fprintf(stderr," command file = <%s>\n",gr->commandFile()); | 1311 | fprintf(stderr," command file = <%s>\n",gr->commandFile()); |
525 | 1265 | fprintf(stderr," putlog file = <%s>\n",gr->putlogFile()); | 1312 | fprintf(stderr," putlog file = <%s>\n",gr->putlogFile()); |
526 | 1313 | #ifdef WITH_CAPUTLOG | ||
527 | 1314 | fprintf(stderr," caputlog address = <%s>\n",gr->caputlogAddress()); | ||
528 | 1315 | #endif | ||
529 | 1266 | fprintf(stderr," report file = <%s>\n",gr->reportFile()); | 1316 | fprintf(stderr," report file = <%s>\n",gr->reportFile()); |
530 | 1267 | fprintf(stderr," debug level = %d\n",gr->debugLevel()); | 1317 | fprintf(stderr," debug level = %d\n",gr->debugLevel()); |
531 | 1268 | fprintf(stderr," connect timeout = %ld\n",gr->connectTimeout()); | 1318 | fprintf(stderr," connect timeout = %ld\n",gr->connectTimeout()); |
To me, this patch looks good.
I have not settled in well enough to have an environment to actually compile and test the code, though, so I would like Benjamin to also have a look and maybe take this for a test drive.