Merge lp:~epics-documenters/epics-appdev/dbServer-api into lp:~epics-documenters/epics-appdev/3.16
- dbServer-api
- Merge into 3.16
Proposed by
Andrew Johnson
Status: | Merged |
---|---|
Approved by: | Ralph Lange |
Approved revision: | 57 |
Merged at revision: | 59 |
Proposed branch: | lp:~epics-documenters/epics-appdev/dbServer-api |
Merge into: | lp:~epics-documenters/epics-appdev/3.16 |
Diff against target: |
674 lines (+210/-57) 1 file modified
tex/runtimeDatabaseAccess.tex (+210/-57) |
To merge this branch: | bzr merge lp:~epics-documenters/epics-appdev/dbServer-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ralph Lange | Approve | ||
Review via email: mp+232339@code.launchpad.net |
Commit message
Description of the change
Documentation for the dbServer-api branch of epics-base.
To post a comment you must log in.
- 57. By Ralph Lange
-
dbServer API: fix typos.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'tex/runtimeDatabaseAccess.tex' |
2 | --- tex/runtimeDatabaseAccess.tex 2014-05-20 23:05:22 +0000 |
3 | +++ tex/runtimeDatabaseAccess.tex 2014-09-17 11:52:24 +0000 |
4 | @@ -1,12 +1,14 @@ |
5 | -\chapter{Runtime Database Access}\index{Runtime Database Access} |
6 | +\chapter{Runtime Database Access} |
7 | +\index{Runtime Database Access} |
8 | |
9 | \section{Overview} |
10 | |
11 | This chapter describes routines for manipulating and accessing an initialized IOC database. |
12 | |
13 | -This chapter is divided into the following sections: |
14 | +This chapter is divided into several sections: |
15 | |
16 | \begin{itemize} |
17 | + |
18 | \item Database related include files. |
19 | All of interest are listed and those of general interest are discussed briefly. |
20 | |
21 | @@ -28,12 +30,15 @@ |
22 | Of particular interest to this chapter are: |
23 | |
24 | \begin{itemize} |
25 | -\item \index{dbDefs.h}dbDefs.h: Miscellaneous database related definitions |
26 | - |
27 | -\item \index{dbFldTypes.h}dbFldTypes.h: Field type definitions |
28 | + |
29 | +\item \index{dbDefs.h}dbDefs.h: Miscellaneous database related definitions. |
30 | + |
31 | +\item \index{dbFldTypes.h}dbFldTypes.h: Field type definitions. |
32 | |
33 | \item \index{dbAccess.h}dbAccess.h: Runtime database access definitions. |
34 | |
35 | +\item \index{dbServer.h}dbServer.h: API for server implementers. |
36 | + |
37 | \item \index{link.h}link.h: Definitions for link fields. |
38 | |
39 | \end{itemize} |
40 | @@ -45,6 +50,7 @@ |
41 | The most important are: |
42 | |
43 | \begin{itemize} |
44 | + |
45 | \item \index{PVNAME\_STRINGSZ}PVNAME\_STRINGSZ: The number of characters reserved for the record name, including the terminating zero byte. |
46 | |
47 | \item \index{PVNAME\_SZ}PVNAME\_SZ: The maximum number of characters allowed in the record name. |
48 | @@ -65,6 +71,7 @@ |
49 | The field types are: |
50 | |
51 | \begin{itemize} |
52 | + |
53 | \item \index{DBF\_STRING}DBF\_STRING: 40 character ASCII string |
54 | |
55 | \item \index{DBF\_CHAR}DBF\_CHAR: Signed character |
56 | @@ -119,6 +126,7 @@ |
57 | There are three classes of links: |
58 | |
59 | \begin{enumerate} |
60 | + |
61 | \item Constant - The value associated with the field is a floating point value initialized with a constant value. |
62 | This is somewhat of a misnomer because constant link fields can be modified via \verb|dbPutField| or \verb|dbPutLink|. |
63 | |
64 | @@ -166,7 +174,9 @@ |
65 | \index{struct dbAddr} |
66 | \index{dbAdd} |
67 | \index{DBADDR} |
68 | + |
69 | \begin{itemize} |
70 | + |
71 | \item \index{precord - DBADDR}precord: Address of record. |
72 | Note that its type is a pointer to a structure defining the fields common to all record types. |
73 | The common fields appear at the beginning of each record. |
74 | @@ -196,35 +206,41 @@ |
75 | |
76 | \end{itemize} |
77 | |
78 | -NOTE: \verb|pfield|, \verb|no_elements|, \verb|field_type|, \verb|field_size|, \verb|special|, and \verb|dbr_field_type| can all be set by |
79 | -record support (\verb|cvt_dbaddr|). |
80 | +NOTE: \verb|pfield|, \verb|no_elements|, \verb|field_type|, |
81 | +\verb|field_size|, \verb|special|, and \verb|dbr_field_type| |
82 | +can all be set by record support (\verb|cvt_dbaddr|). |
83 | Thus \verb|field_type|, \verb|field_size|, and \verb|special| can differ from that specified by \verb|pfldDes|. |
84 | |
85 | -\subsection{link.h } |
86 | +\subsection{dbServer.h} |
87 | + |
88 | +This header provides an optional API allowing the IOC to display information about the services that are connecting to and using the IOC. |
89 | + |
90 | +\subsection{link.h} |
91 | |
92 | This header file describes the various types of link fields supported by EPICS. |
93 | |
94 | \section{Runtime Database Access Overview} |
95 | |
96 | -With the exception of record and device support, all access to the database is via the channel or database access routines. |
97 | +With the exception of record and device support, all access to the database is via the database access routines. |
98 | Even record support routines access other records only via database or channel access. |
99 | Channel Access, in turn, accesses the database via database access. |
100 | +Other services can similarly be layered on top of the IOC, using database access to manipulate record field values and cause records to be processed. |
101 | |
102 | Perhaps the easiest way to describe the database access layer is to list and briefly describe the set of routines that constitute database access. |
103 | This provides a good look at the facilities provided by the database. |
104 | |
105 | Before describing database access, one caution must be mentioned. |
106 | -The only way to communicate with an IOC database from outside the IOC is via Channel Access. |
107 | -In addition, any special purpose software, i.e. any software not described in |
108 | -this document, should communicate with the database via Channel Access, not database access, even if it resides in the same IOC as the database. |
109 | +The usual way to communicate with an IOC database from outside the IOC is via Channel Access, although other similar network server layers can be added. |
110 | +Most client applications should communicate with the database via Channel Access, not via database access, even if they reside in the same IOC process as the database. |
111 | Since Channel Access provides network independent access to a database, it must ultimately call database access routines. |
112 | -The database access interface was changed in 1991, but Channel Access was never changed to use the new interface. |
113 | -Instead a module was written which translates old style database access calls to new. |
114 | +The database access interface was enhanced in 1991, but Channel Access could not be changed to use the new interface as this would break existing client applications. |
115 | +Instead a module was written which translates the original database access API into the new API. |
116 | This interface between the old and new style database access calls is not discussed in this manual. |
117 | |
118 | The \index{database access routines - List of}database access routines are: |
119 | |
120 | \begin{itemize} |
121 | + |
122 | \item dbNameToAddr: Locate a database variable. |
123 | |
124 | \item dbGetField: Get values associated with a database variable. |
125 | @@ -301,6 +317,7 @@ |
126 | This argument has one of the following values: |
127 | |
128 | \begin{itemize} |
129 | + |
130 | \item \index{DBR\_STRING}DBR\_STRING: Value is a \verb|NULL| terminated string |
131 | |
132 | \item \index{DBR\_CHAR}DBR\_CHAR: Value is a signed char |
133 | @@ -337,6 +354,7 @@ |
134 | The complete set of options is: |
135 | |
136 | \begin{itemize} |
137 | + |
138 | \item \index{DBR\_STATUS}DBR\_STATUS: returns the alarm status and severity |
139 | |
140 | \item \index{DBR\_UNITS}DBR\_UNITS: returns a string specifying the engineering units |
141 | @@ -540,6 +558,7 @@ |
142 | \index{dbGet}This routine retrieves the data referenced by \verb|paddr| and converts it to the format specified by \verb|dbrType|. |
143 | |
144 | \begin{itemize} |
145 | + |
146 | \item \verb|options| is a read/write field. |
147 | Upon entry to \verb|dbGet|, \verb|options| specifies the desired options. |
148 | When \verb|dbGetField| returns, \verb|options| specifies the options actually honored. |
149 | @@ -586,6 +605,7 @@ |
150 | The actual algorithm for \verb|dbPutField| is: |
151 | |
152 | \begin{enumerate} |
153 | + |
154 | \item If the \verb|DISP| field is \verb|TRUE| then, unless it is the \verb|DISP| field itself which is being modified, the field is not written. |
155 | |
156 | \item The record is locked. |
157 | @@ -633,6 +653,7 @@ |
158 | For database links it performs the following functions: |
159 | |
160 | \begin{enumerate} |
161 | + |
162 | \item Calls \verb|dbPut|. |
163 | |
164 | \item Implements maximize severity. |
165 | @@ -672,18 +693,27 @@ |
166 | The Process Notify subsystem provides the following features: |
167 | |
168 | \begin{enumerate} |
169 | + |
170 | \item Processes a record with notification of completion. |
171 | + |
172 | \item Put after the record is claimed but before before the process. |
173 | + |
174 | \item Get after the process but before the record is released. |
175 | + |
176 | \item put, then process, then get. |
177 | + |
178 | \end{enumerate} |
179 | |
180 | A process request will be issued if any of the following is true: |
181 | |
182 | \begin{itemize} |
183 | + |
184 | \item The requester has issued a processs request and record is passive. |
185 | + |
186 | \item The requester is doing a put, the record is passive, and either the field description is process passive or the field is PROC. |
187 | + |
188 | \item The requester has requested a processGet or a putProcessGet request and the record is passive. |
189 | + |
190 | \end{itemize} |
191 | |
192 | At most one process is performed per \verb|dbProcessNotify| request. |
193 | @@ -748,6 +778,7 @@ |
194 | Before calling \verb|dbProcessNotify| the following fields must be given values: |
195 | |
196 | \begin{itemize} |
197 | + |
198 | \item \verb|requestType| - The request type. |
199 | |
200 | \item \verb|paddr| - A struct dbAddr, which is given values by a call to \verb|dbNameToAddr|. |
201 | @@ -771,6 +802,7 @@ |
202 | The \verb|notifyPutType| argument to \verb|putCallback| is one of these values: |
203 | |
204 | \begin{itemize} |
205 | + |
206 | \item \verb|putDisabledType| - Puts are disabled. |
207 | The client must not issue a put. |
208 | |
209 | @@ -785,19 +817,25 @@ |
210 | The \verb|notifyGetType| argument to \verb|getCallback| will be one of these values: |
211 | |
212 | \begin{itemize} |
213 | + |
214 | \item \verb|getFieldType| - The client may issue a \verb|dbGetField| request. |
215 | This is returned when \verb|paddr| refers to a link field. |
216 | For link fields the record will never be processed as a result of the \verb|dbProcessNotify|. |
217 | |
218 | \item \verb|getType| - The client may issue a \verb|dbGet| request. |
219 | + |
220 | \end{itemize} |
221 | |
222 | The \verb|notifyStatus| argument to \verb|doneCallback| is one of these values: |
223 | |
224 | \begin{itemize} |
225 | + |
226 | \item \verb|notifyOK| - The \verb|dbProcessNotify| request was successful and the record was processed. |
227 | + |
228 | \item \verb|notifyNoProcessOK| - The \verb|dbProcessNotify| request was successful but the record was not processed. |
229 | + |
230 | \item \verb|notifyError| - An error occured. |
231 | + |
232 | \end{itemize} |
233 | |
234 | Example code can be found in the routine \verb|dbtpn| which is defined in \verb|base/src/ioc/db/dbNotify.c|. It uses both \verb|putProcesssRequest| and \verb|processGetRequest|. |
235 | @@ -807,23 +845,39 @@ |
236 | EPICS base provides soft device support that uses processNotify for both input and output record types. All use the device type name ``Asyn Soft Channel''. |
237 | |
238 | The input types issue a \verb|processGetRequest|: |
239 | + |
240 | \begin{itemize} |
241 | + |
242 | \item \verb|devAiSoftCallback| - Supports aiRecord. |
243 | + |
244 | \item \verb|devBiSoftCallback| - Supports biRecord. |
245 | + |
246 | \item \verb|devMbbiSoftCallback| - Supports mbbiRecord. |
247 | + |
248 | \item \verb|devMbbiDirectSoftCallback| - Supports mbbiDirectRecord. |
249 | + |
250 | \item \verb|devLiSoftCallback| - Supports longinRecord. |
251 | + |
252 | \item \verb|devSiSoftCallback| - Supports stringinRecord. |
253 | + |
254 | \end{itemize} |
255 | |
256 | The output types issue a channel access \verb|ca_put_callback| request. |
257 | + |
258 | \begin{itemize} |
259 | + |
260 | \item \verb|devAoSoftCallback| - Supports aoRecord. |
261 | + |
262 | \item \verb|devBoSoftCallback| - Supports boRecord. |
263 | + |
264 | \item \verb|devCalcoutSoftCallback| - Supports calcoutRecord. |
265 | + |
266 | \item \verb|devMbboSoftCallback| - Supports mbboRecord. |
267 | + |
268 | \item \verb|devMbboDirectSoftCallback| - Supports mbboDirectRecord. |
269 | + |
270 | \item \verb|devSiSoftCallback| - Supports longoutRecord. |
271 | + |
272 | \end{itemize} |
273 | |
274 | |
275 | @@ -1155,49 +1209,53 @@ |
276 | User code only calls \verb|dbScanLock| and \verb|dbScanUnlock|. |
277 | All other routines are called by \verb|iocCore|. |
278 | |
279 | -\subsubsection{dbScanLock} |
280 | +\subsection{dbScanLock} |
281 | |
282 | Lock a lock set: |
283 | |
284 | \begin{verbatim} |
285 | long void dbScanLock(struct dbCommon *precord); |
286 | \end{verbatim} |
287 | - |
288 | -\index{dbScanLock}Lock the lock set to which the specified record belongs. |
289 | - |
290 | -\subsubsection{dbScanUnlock} |
291 | +\index{dbScanLock} |
292 | + |
293 | +Lock the lock set to which the specified record belongs. |
294 | + |
295 | +\subsection{dbScanUnlock} |
296 | |
297 | Unlock a lock set: |
298 | |
299 | \begin{verbatim} |
300 | long void dbScanUnlock(struct dbCommon *precord); |
301 | \end{verbatim} |
302 | - |
303 | -\index{dbScanUnlock}Lock the lock set to which the specified record belongs |
304 | - |
305 | -\subsubsection{dbLockGetLockId} |
306 | +\index{dbScanUnlock} |
307 | + |
308 | +Lock the lock set to which the specified record belongs |
309 | + |
310 | +\subsection{dbLockGetLockId} |
311 | |
312 | Get lock set id: |
313 | |
314 | \begin{verbatim} |
315 | long dbLockGetLockId(struct dbCommon *precord); |
316 | \end{verbatim} |
317 | +\index{dbLockGetLockId} |
318 | |
319 | -\index{dbLockGetLockId}Each lock set is assigned a unique ID. |
320 | +Each lock set is assigned a unique ID. |
321 | This routine retrieves it. |
322 | This is most useful to determine if two records are in the same lock set. |
323 | |
324 | -\subsubsection{dbLockInitRecords} |
325 | +\subsection{dbLockInitRecords} |
326 | |
327 | Determine lock sets for each record in database. |
328 | |
329 | \begin{verbatim} |
330 | void dbLockInitRecords(dbBase *pdbbase); |
331 | \end{verbatim} |
332 | - |
333 | -\index{dbLockInitRecords}Called by \verb|iocInit|. |
334 | - |
335 | -\subsubsection{dbLockSetMerge} |
336 | +\index{dbLockInitRecords} |
337 | + |
338 | +Called by \verb|iocInit|. |
339 | + |
340 | +\subsection{dbLockSetMerge} |
341 | |
342 | Merge records into same lock set. |
343 | |
344 | @@ -1205,49 +1263,53 @@ |
345 | void dbLockSetMerge(struct dbCommon *pfirst, |
346 | struct dbCommon *psecond); |
347 | \end{verbatim} |
348 | - |
349 | \index{dbLockSetMerge} |
350 | + |
351 | If specified records are not in same lock set the lock sets are merged. |
352 | Called by dbLockInitRecords and also when links are modified by \verb|dbPutField|. |
353 | |
354 | -\subsubsection{dbLockSetSplitSl} |
355 | +\subsection{dbLockSetSplit} |
356 | |
357 | Recompute lock sets for given lock set |
358 | |
359 | \begin{verbatim} |
360 | void dbLockSetSplit(struct dbCommon *psource); |
361 | \end{verbatim} |
362 | - |
363 | -\index{dbLockSetSplit}This is called when \verb|dbPutField| modifies links. |
364 | - |
365 | -\subsubsection{dbLockSetGblLock} |
366 | +\index{dbLockSetSplit} |
367 | + |
368 | +This is called when \verb|dbPutField| modifies links. |
369 | + |
370 | +\subsection{dbLockSetGblLock} |
371 | |
372 | Global lock for modifying links. |
373 | |
374 | \begin{verbatim} |
375 | void dbLockSetGblLock(void); |
376 | \end{verbatim} |
377 | +\index{dbLockSetGblLock} |
378 | |
379 | -\index{dbLockSetGblLock}Only one task at a time can modify link fields. |
380 | +Only one task at a time can modify link fields. |
381 | This routine provides a global lock to prevent conflicts. |
382 | |
383 | -\subsubsection{dbLockSetGblUnlock} |
384 | +\subsection{dbLockSetGblUnlock} |
385 | |
386 | Unlock the global lock. |
387 | |
388 | \begin{verbatim} |
389 | void dbLockSetGblUnlock(void); |
390 | \end{verbatim} |
391 | +\index{dbLockSetGblUnlock} |
392 | |
393 | -\index{dbLockSetGblUnlock}\subsubsection{dbLockSetRecordLock} |
394 | +\subsection{dbLockSetRecordLock} |
395 | |
396 | If record is not already scan locked lock it. |
397 | |
398 | \begin{verbatim} |
399 | void dbLockSetRecordLock(struct dbCommon *precord); |
400 | \end{verbatim} |
401 | +\index{dbLockSetRecordLock} |
402 | |
403 | -\index{dbLockSetRecordLock}\section{Channel Access Database Links} |
404 | +\section{Channel Access Database Links} |
405 | |
406 | The routines described here are used to create and manipulate Channel Access connections from database input or output links. |
407 | At IOC initialization an attempt is made to convert all process variable links to database links. |
408 | @@ -1281,23 +1343,26 @@ |
409 | \begin{verbatim} |
410 | void dbCaLinkInit(void); |
411 | \end{verbatim} |
412 | +\index{dbCaLinkInit} |
413 | |
414 | -\index{dbCaLinkInit}\subsubsection{dbCaAddLink} |
415 | +\subsubsection{dbCaAddLink} |
416 | |
417 | Add a new channel access link |
418 | |
419 | \begin{verbatim} |
420 | void dbCaAddLink(struct link *plink); |
421 | \end{verbatim} |
422 | +\index{dbCaAddLink} |
423 | |
424 | -\index{dbCaAddLink}\subsubsection{dbCaAddLinkCallback} |
425 | +\subsubsection{dbCaAddLinkCallback} |
426 | |
427 | \begin{verbatim} |
428 | void dbCaAddLinkCallback(struct link *plink, |
429 | dbCaCallback connect,dbCaCallback monitor,void *userPvt); |
430 | \end{verbatim} |
431 | +\index{dbCaAddLinkCallback} |
432 | |
433 | -\index{dbCaAddLinkCallback}\verb|connect| will be called whenever the link connects or disconnects. |
434 | +\verb|connect| will be called whenever the link connects or disconnects. |
435 | \verb|monitor| will be called whenever a monitor event occurs. |
436 | \verb|connect| and or \verb|monitor| may be null. |
437 | |
438 | @@ -1308,8 +1373,8 @@ |
439 | \begin{verbatim} |
440 | void dbCaRemoveLink(struct link *plink); |
441 | \end{verbatim} |
442 | - |
443 | \index{dbCaRemoveLink} |
444 | + |
445 | \subsubsection{dbCaGetLink} |
446 | |
447 | Get link value |
448 | @@ -1318,8 +1383,8 @@ |
449 | long dbCaGetLink(struct link *plink,short dbrType, |
450 | void *pbuffer,unsigned short *psevr,long *nRequest); |
451 | \end{verbatim} |
452 | - |
453 | \index{dbCaGetLink} |
454 | + |
455 | \subsubsection{dbCaPutLink} |
456 | |
457 | Put link value |
458 | @@ -1328,8 +1393,8 @@ |
459 | long dbCaPutLink(struct link *plink,short dbrType, |
460 | void *buffering nRequest); |
461 | \end{verbatim} |
462 | - |
463 | \index{dbCaPutLink} |
464 | + |
465 | \subsubsection{dbCaPutLinkCallback} |
466 | |
467 | This is meant for use by device or record support that wants a put to complete before completing record processing. |
468 | @@ -1338,9 +1403,9 @@ |
469 | long dbCaPutLinkCallback(struct link *plink,short dbrType, |
470 | const void *pbuffer,long nRequest,dbCaPutCallback callback); |
471 | \end{verbatim} |
472 | - |
473 | \index{dbCaPutLinkCallback} |
474 | \index{devAoSoftCallback.c} |
475 | + |
476 | \textless{}base\textgreater{}/src/std/dev/devAoSoftCallback.c provides an example of how to use this function. |
477 | It contains: |
478 | |
479 | @@ -1405,8 +1470,9 @@ |
480 | \begin{verbatim} |
481 | int dbCaIsLinkConnected(struct link *plink) |
482 | \end{verbatim} |
483 | +\index{dbCaIsLinkConnected} |
484 | |
485 | -\index{dbCaIsLinkConnected}This routine returns (TRUE, FALSE) if the link (is, is not) connected. |
486 | +This routine returns (TRUE, FALSE) if the link (is, is not) connected. |
487 | |
488 | \subsubsection{dbCaGetNelements} |
489 | |
490 | @@ -1415,8 +1481,9 @@ |
491 | \begin{verbatim} |
492 | long dbCaGetNelements(struct link *plink,long *nelements); |
493 | \end{verbatim} |
494 | +\index{dbCaGetNelements} |
495 | |
496 | -\index{dbCaGetNelements}This call, which returns an error if the link is not connected, sets the native number of elements. |
497 | +This call, which returns an error if the link is not connected, sets the native number of elements. |
498 | |
499 | \subsubsection{dbCaGetSevr} |
500 | |
501 | @@ -1425,8 +1492,9 @@ |
502 | \begin{verbatim} |
503 | long dbCaGetSevr(struct link *plink,short *severity); |
504 | \end{verbatim} |
505 | +\index{dbCaGetSevr} |
506 | |
507 | -\index{dbCaGetSevr}This call, which returns an error if the link is not connected, sets the alarm severity. |
508 | +This call, which returns an error if the link is not connected, sets the alarm severity. |
509 | |
510 | \subsubsection{dbCaGetTimeStamp} |
511 | |
512 | @@ -1435,8 +1503,9 @@ |
513 | \begin{verbatim} |
514 | long dbCaGetTimeStamp(struct link *plink,TS_STAMP *pstamp)); |
515 | \end{verbatim} |
516 | +\index{dbCaGetTimeStamp} |
517 | |
518 | -\index{dbCaGetTimeStamp}This call, which returns an error if the link is not connected, sets pstamp to the time obtained by the last CA monitor. |
519 | +This call, which returns an error if the link is not connected, sets pstamp to the time obtained by the last CA monitor. |
520 | |
521 | \subsubsection{dbCaGetLinkDBFtype} |
522 | |
523 | @@ -1445,8 +1514,9 @@ |
524 | \begin{verbatim} |
525 | int dbCaGetLinkDBFtype(struct link *plink); |
526 | \end{verbatim} |
527 | +\index{dbCaGetLinkDBFtype} |
528 | |
529 | -\index{dbCaGetLinkDBFtype}This call, which returns an error if the link is not connected, returns the field type. |
530 | +This call, which returns an error if the link is not connected, returns the field type. |
531 | |
532 | \subsubsection{dbCaGetAttributes} |
533 | |
534 | @@ -1456,8 +1526,9 @@ |
535 | long dbCaGetAttributes(struct link *plink, |
536 | void (*callback)(void *usrPvt),void *usrPvt); |
537 | \end{verbatim} |
538 | +\index{dbCaGetAttributes} |
539 | |
540 | -\index{dbCaGetAttributes}When ever dbCa receives a connection it issues a CA get request to obtain the control, graphic, and alarm limits and to obtain the precision and units. |
541 | +When ever dbCa receives a connection it issues a CA get request to obtain the control, graphic, and alarm limits and to obtain the precision and units. |
542 | By calling dbCaGetAttributes the caller can be notified when this get completes. |
543 | |
544 | \subsubsection{dbCaGetControlLimits} |
545 | @@ -1467,8 +1538,9 @@ |
546 | \begin{verbatim} |
547 | long dbCaGetControlLimits(struct link *plink,double *low, double *high); |
548 | \end{verbatim} |
549 | +\index{dbCaGetControlLimits} |
550 | |
551 | -\index{dbCaGetControlLimits}This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
552 | +This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
553 | If it returns success it has set the control limits. |
554 | |
555 | \subsubsection{dbCaGetGraphicLimits} |
556 | @@ -1478,8 +1550,9 @@ |
557 | \begin{verbatim} |
558 | long dbCaGetGraphicLimits(struct link *plink,double *low, double *high); |
559 | \end{verbatim} |
560 | +\index{dbCaGetGraphicLimits} |
561 | |
562 | -\index{dbCaGetGraphicLimits}This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
563 | +This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
564 | If it returns success it has set the graphic limits. |
565 | |
566 | \subsubsection{dbCaGetAlarmLimits} |
567 | @@ -1490,8 +1563,9 @@ |
568 | long dbCaGetAlarmLimits(struct link *plink, |
569 | double *lolo, double *low, double *high, double *hihi); |
570 | \end{verbatim} |
571 | +\index{dbCaGetAlarmLimits} |
572 | |
573 | -\index{dbCaGetAlarmLimits}This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
574 | +This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
575 | If it returns success it has set the alarm limits. |
576 | |
577 | \subsubsection{dbCaGetPrecision} |
578 | @@ -1501,8 +1575,9 @@ |
579 | \begin{verbatim} |
580 | long dbCaGetPrecision(struct link *plink,short *precision); |
581 | \end{verbatim} |
582 | +\index{dbCaGetPrecision} |
583 | |
584 | -\index{dbCaGetPrecision}This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
585 | +This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
586 | If it returns success it has set the precision. |
587 | |
588 | \subsubsection{dbCaGetUnits} |
589 | @@ -1512,6 +1587,84 @@ |
590 | \begin{verbatim} |
591 | long dbCaGetUnits(struct link *plink,char *units,int unitsSize); |
592 | \end{verbatim} |
593 | +\index{dbCaGetUnits} |
594 | |
595 | -\index{dbCaGetUnits}This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
596 | +This call returns an error if the link is not connected or if the CA get request for limits, etc. has not completed. |
597 | If it returns success it has set the units. |
598 | + |
599 | +\section{dbServer API} |
600 | + |
601 | +Software that provides external access to the IOC database is a server layer. |
602 | +It is helpful for the IOC developer to be able to see information about the servers that are making use of the database access routines for purposes of diagnosing problems and reporting usage statistics. |
603 | +The dbServer API is provided to allow the IOC code to display specific kinds of information from the servers connected to it, without having to integrate those servers into the IOC code. |
604 | +Server layers are thus encouraged to register a dbServer structure with the IOC database to allow this information to be retrieved as needed. |
605 | + |
606 | +\subsection{Registering a server layer} |
607 | + |
608 | +The dbServer structure is defined in dbServer.h as follows: |
609 | + |
610 | +\begin{verbatim} |
611 | +typedef struct dbServer { |
612 | + ELLNODE node; |
613 | + const char *name; |
614 | + |
615 | + /* Print level-dependent status report to stdout */ |
616 | + void (* report) (unsigned level); |
617 | + |
618 | + /* Get number of channels and clients connected */ |
619 | + void (* stats) (unsigned *channels, unsigned *clients); |
620 | + |
621 | + /* Get identity of client initiating the calling thread */ |
622 | + /* Must return 0 (OK), or -1 (ERROR) from unknown threads */ |
623 | + int (* client) (char *pBuf, size_t bufSize); |
624 | +} dbServer; |
625 | +\end{verbatim} |
626 | +\index{dbServer} |
627 | + |
628 | +A server layer should instantiate one of these and pass a pointer to it to dbRegisterServer: |
629 | + |
630 | +\begin{verbatim} |
631 | +void dbRegisterServer(dbServer *psrv); |
632 | +\end{verbatim} |
633 | +\index{dbRegisterServer} |
634 | + |
635 | +The individual function pointers in the structure are optional, use NULL if a specific routine has not been implemented for this server. |
636 | +Additional function pointers may be added to the end of this structure in future releases, while aiming to keep API-compatibility with older versions. |
637 | +The functions provided by the server layer are used as follows. |
638 | + |
639 | +\begin{itemize} |
640 | + |
641 | +\item \index{report - dbServer routine}report: This routine should print a status report to stdout. Increasing interest levels should provide additional information. |
642 | + |
643 | +\item \index{stats - dbServer routine}stats: This routine returns the current count of the number of channels and clients connected through this service. |
644 | + |
645 | +\item \index{client - dbServer routine}client: When called by one of the server's threads, this routine should fill in the buffer with a short string identifying the specific client (e.g. \verb|user@host|), and return 0. If the calling thread does not belong to this server it should just return -1. |
646 | + |
647 | +\end{itemize} |
648 | + |
649 | +\subsection{Interacting with Server layers} |
650 | + |
651 | +The dbServer.h header makes the following routines available to the IOC code. |
652 | + |
653 | +\subsubsection{dbsr - Server Report} |
654 | + |
655 | +\begin{verbatim} |
656 | +void dbsr(unsigned level); |
657 | +\end{verbatim} |
658 | +\index{dbsr} |
659 | + |
660 | +This routine scans through the list of registered servers, printing the server's name and then calling its report function if one exists. |
661 | +This is an iocsh command that is intended to replace \verb|casr|, and is only called on demand by the user. |
662 | + |
663 | +\subsubsection{dbServerClient - Identifying a client thread} |
664 | + |
665 | +\begin{verbatim} |
666 | +int dbServerClient(char *pBuf, size_t bufSize); |
667 | +\end{verbatim} |
668 | +\index{dbServerClient} |
669 | + |
670 | +When the IOC processes a record that has its TPRO field set, this routine is called to obtain a server context for the printed record name. |
671 | +It iterates through all of the registered servers in turn calling their \verb|client()| routines until one of them returns OK or the end of the list is reached. |
672 | +If no server returns OK the routine returns -1. |
673 | + |
674 | + |
Looks good. (I pushed some minor typo fixes.)