EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cadef.h
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * SPDX-License-Identifier: EPICS
7 * EPICS BASE is distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 /*
11  *
12  * L O S A L A M O S
13  * Los Alamos National Laboratory
14  * Los Alamos, New Mexico 87545
15  *
16  * Copyright, 1986, The Regents of the University of California.
17  *
18  * Author Jeffrey O. Hill
20  * 505 665 1831
21  *
22  */
23 
24 #ifndef INC_cadef_H
25 #define INC_cadef_H
26 
27 /*
28  * done in two ifdef steps so that we will remain compatible with
29  * traditional C
30  */
31 #ifndef CA_DONT_INCLUDE_STDARGH
32 # include <stdarg.h>
33 #endif
34 
35 #include "epicsThread.h"
36 
37 #include "libCaAPI.h"
38 #include "caerr.h"
39 #include "db_access.h"
40 #include "caeventmask.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct oldChannelNotify *chid;
47 typedef chid chanId; /* for when the structures field name is "chid" */
48 typedef long chtype;
49 typedef struct oldSubscription *evid;
50 typedef double ca_real;
51 
52 /* arguments passed to user connection handlers */
54  chanId chid; /* channel id */
55  long op; /* one of CA_OP_CONN_UP or CA_OP_CONN_DOWN */
56 };
57 
58 typedef void caCh (struct connection_handler_args args);
59 
60 typedef struct ca_access_rights {
61  unsigned read_access:1;
62  unsigned write_access:1;
63 } caar;
64 
65 /* arguments passed to user access rights handlers */
67  chanId chid; /* channel id */
68  caar ar; /* new access rights state */
69 };
70 
71 typedef void caArh (struct access_rights_handler_args args);
72 
73 /* The conversion routine to call for each type */
74 #define VALID_TYPE(TYPE) (((unsigned short)TYPE)<=LAST_BUFFER_TYPE)
75 
76 /*
77  * Arguments passed to event handlers and get/put call back handlers.
78  *
79  * The status field below is the CA ECA_XXX status of the requested
80  * operation which is saved from when the operation was attempted in the
81  * server and copied back to the clients call back routine.
82  * If the status is not ECA_NORMAL then the dbr pointer will be NULL
83  * and the requested operation can not be assumed to be successful.
84  */
85 typedef struct event_handler_args {
86  void *usr; /* user argument supplied with request */
87  chanId chid; /* channel id */
88  long type; /* the type of the item returned */
89  long count; /* the element count of the item returned */
90  const void *dbr; /* a pointer to the item returned */
91  int status; /* ECA_XXX status of the requested op from the server */
92 } evargs;
93 typedef void caEventCallBackFunc (struct event_handler_args);
94 
95 LIBCA_API void epicsStdCall ca_test_event
96 (
97  struct event_handler_args
98 );
99 
100 /* arguments passed to user exception handlers */
102  void *usr; /* user argument supplied when installed */
103  chanId chid; /* channel id (may be nill) */
104  long type; /* type requested */
105  long count; /* count requested */
106  void *addr; /* user's address to write results of CA_OP_GET */
107  long stat; /* channel access ECA_XXXX status code */
108  long op; /* CA_OP_GET, CA_OP_PUT, ..., CA_OP_OTHER */
109  const char *ctx; /* a character string containing context info */
110  const char *pFile; /* source file name (may be NULL) */
111  unsigned lineNo; /* source file line number (may be zero) */
112 };
113 
114 typedef unsigned CA_SYNC_GID;
115 
116 /*
117  * External OP codes for CA operations
118  */
119 #define CA_OP_GET 0
120 #define CA_OP_PUT 1
121 #define CA_OP_CREATE_CHANNEL 2
122 #define CA_OP_ADD_EVENT 3
123 #define CA_OP_CLEAR_EVENT 4
124 #define CA_OP_OTHER 5
125 
126 /*
127  * used with connection_handler_args
128  */
129 #define CA_OP_CONN_UP 6
130 #define CA_OP_CONN_DOWN 7
131 
132 /* deprecated */
133 #define CA_OP_SEARCH 2
134 
135 /*
136  * provides efficient test and display of channel access errors
137  */
138 #define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING) \
139 { \
140  int ca_unique_status_name = (CA_ERROR_CODE); \
141  if(!(ca_unique_status_name & CA_M_SUCCESS)) \
142  ca_signal_with_file_and_lineno( \
143  ca_unique_status_name, \
144  (MESSAGE_STRING), \
145  __FILE__, \
146  __LINE__); \
147 }
148 
149 
150 #define TYPENOTCONN (-1) /* the channel's native type when disconnected */
151 LIBCA_API short epicsStdCall ca_field_type (chid chan);
152 LIBCA_API unsigned long epicsStdCall ca_element_count (chid chan);
153 LIBCA_API const char * epicsStdCall ca_name (chid chan);
154 LIBCA_API void epicsStdCall ca_set_puser (chid chan, void *puser);
155 LIBCA_API void * epicsStdCall ca_puser (chid chan);
156 LIBCA_API unsigned epicsStdCall ca_read_access (chid chan);
157 LIBCA_API unsigned epicsStdCall ca_write_access (chid chan);
158 
159 /*
160  * cs_ - `channel state'
161  *
162  * cs_never_conn valid chid, IOC not found
163  * cs_prev_conn valid chid, IOC was found, but unavailable
164  * cs_conn valid chid, IOC was found, still available
165  * cs_closed channel deleted by user
166  */
167 enum channel_state {cs_never_conn, cs_prev_conn, cs_conn, cs_closed};
168 LIBCA_API enum channel_state epicsStdCall ca_state (chid chan);
169 
170 /************************************************************************/
171 /* Perform Library Initialization */
172 /* */
173 /* Must be called once before calling any of the other routines */
174 /************************************************************************/
175 LIBCA_API int epicsStdCall ca_task_initialize (void);
176 enum ca_preemptive_callback_select
177 { ca_disable_preemptive_callback, ca_enable_preemptive_callback };
178 LIBCA_API int epicsStdCall
179  ca_context_create (enum ca_preemptive_callback_select select);
180 LIBCA_API void epicsStdCall ca_detach_context ();
181 
182 /************************************************************************/
183 /* Remove CA facility from your task */
184 /* */
185 /* Normally called automatically at task exit */
186 /************************************************************************/
187 LIBCA_API int epicsStdCall ca_task_exit (void);
188 LIBCA_API void epicsStdCall ca_context_destroy (void);
189 
190 typedef unsigned capri;
191 #define CA_PRIORITY_MAX 99
192 #define CA_PRIORITY_MIN 0
193 #define CA_PRIORITY_DEFAULT CA_PRIORITY_MIN
194 
195 #define CA_PRIORITY_DB_LINKS 80
196 #define CA_PRIORITY_ARCHIVE 20
197 #define CA_PRIORITY_OPI 0
198 
199 /*
200  * ca_create_channel ()
201  *
202  * pChanName R channel name string
203  * pConnStateCallback R address of connection state change
204  * callback function
205  * pUserPrivate R placed in the channel's user private field
206  * o can be fetched later by ca_puser(CHID)
207  * o passed as void * arg to *pConnectCallback above
208  * priority R priority level in the server 0 - 100
209  * pChanID RW channel id written here
210  */
211 LIBCA_API int epicsStdCall ca_create_channel
212 (
213  const char *pChanName,
214  caCh *pConnStateCallback,
215  void *pUserPrivate,
216  capri priority,
217  chid *pChanID
218 );
219 
220 /*
221  * ca_change_connection_event()
222  *
223  * chan R channel identifier
224  * pfunc R address of connection call-back function
225  */
226 LIBCA_API int epicsStdCall ca_change_connection_event
227 (
228  chid chan,
229  caCh * pfunc
230 );
231 
232 /*
233  * ca_replace_access_rights_event ()
234  *
235  * chan R channel identifier
236  * pfunc R address of access rights call-back function
237  */
238 LIBCA_API int epicsStdCall ca_replace_access_rights_event (
239  chid chan,
240  caArh *pfunc
241 );
242 
243 /*
244  * ca_add_exception_event ()
245  *
246  * replace the default exception handler
247  *
248  * pfunc R address of exception call-back function
249  * pArg R copy of this pointer passed to exception
250  * call-back function
251  */
252 typedef void caExceptionHandler (struct exception_handler_args);
253 LIBCA_API int epicsStdCall ca_add_exception_event
254 (
255  caExceptionHandler *pfunc,
256  void *pArg
257 );
258 
259 /*
260  * ca_clear_channel()
261  * - deallocate resources reserved for a channel
262  *
263  * chanId R channel ID
264  */
265 LIBCA_API int epicsStdCall ca_clear_channel
266 (
267  chid chanId
268 );
269 
270 /************************************************************************/
271 /* Write a value to a channel */
272 /************************************************************************/
273 /*
274  * ca_bput()
275  *
276  * WARNING: this copies the new value from a string (dbr_string_t)
277  * (and not as an integer)
278  *
279  * chan R channel identifier
280  * pValue R new channel value string copied from this location
281  */
282 #define ca_bput(chan, pValue) \
283 ca_array_put(DBR_STRING, 1u, chan, (const dbr_string_t *) (pValue))
284 
285 /*
286  * ca_rput()
287  *
288  * WARNING: this copies the new value from a dbr_float_t
289  *
290  * chan R channel identifier
291  * pValue R new channel value copied from this location
292  */
293 #define ca_rput(chan,pValue) \
294 ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue)
295 
296 /*
297  * ca_put()
298  *
299  * type R data type from db_access.h
300  * chan R channel identifier
301  * pValue R new channel value copied from this location
302  */
303 #define ca_put(type, chan, pValue) ca_array_put (type, 1u, chan, pValue)
304 
305 /*
306  * ca_array_put()
307  *
308  * type R data type from db_access.h
309  * count R array element count
310  * chan R channel identifier
311  * pValue R new channel value copied from this location
312  */
313 LIBCA_API int epicsStdCall ca_array_put
314 (
315  chtype type,
316  unsigned long count,
317  chid chanId,
318  const void * pValue
319 );
320 
321 /*
322  * ca_array_put_callback()
323  *
324  * This routine functions identically to the original ca put request
325  * with the addition of a callback to the user supplied function
326  * after recod processing completes in the IOC. The arguments
327  * to the user supplied callback function are declared in
328  * the structure event_handler_args and include the pointer
329  * sized user argument supplied when ca_array_put_callback() is called.
330  *
331  * type R data type from db_access.h
332  * count R array element count
333  * chan R channel identifier
334  * pValue R new channel value copied from this location
335  * pFunc R pointer to call-back function
336  * pArg R copy of this pointer passed to pFunc
337  */
338 LIBCA_API int epicsStdCall ca_array_put_callback
339 (
340  chtype type,
341  unsigned long count,
342  chid chanId,
343  const void * pValue,
344  caEventCallBackFunc * pFunc,
345  void * pArg
346 );
347 
348 #define ca_put_callback(type, chan, pValue, pFunc, pArg) \
349  ca_array_put_callback(type, 1u, chan, pValue, pFunc, pArg)
350 
351 /************************************************************************/
352 /* Read a value from a channel */
353 /************************************************************************/
354 
355 /*
356  * ca_bget()
357  *
358  * WARNING: this copies the new value into a string (dbr_string_t)
359  * (and not into an integer)
360  *
361  * chan R channel identifier
362  * pValue W channel value copied to this location
363  */
364 #define ca_bget(chan, pValue) \
365 ca_array_get(DBR_STRING, 1u, chan, (dbr_string_t *)(pValue))
366 
367 /*
368  * ca_rget()
369  *
370  * WARNING: this copies the new value into a 32 bit float (dbr_float_t)
371  *
372  * chan R channel identifier
373  * pValue W channel value copied to this location
374  */
375 #define ca_rget(chan, pValue) \
376 ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue))
377 
378 /*
379  * ca_rget()
380  *
381  * type R data type from db_access.h
382  * chan R channel identifier
383  * pValue W channel value copied to this location
384  */
385 #define ca_get(type, chan, pValue) ca_array_get(type, 1u, chan, pValue)
386 
387 /*
388  * ca_array_get()
389  *
390  * type R data type from db_access.h
391  * count R array element count
392  * chan R channel identifier
393  * pValue W channel value copied to this location
394  */
395 LIBCA_API int epicsStdCall ca_array_get
396 (
397  chtype type,
398  unsigned long count,
399  chid chanId,
400  void * pValue
401 );
402 
403 /************************************************************************/
404 /* Read a value from a channel and run a callback when the value */
405 /* returns */
406 /* */
407 /* */
408 /************************************************************************/
409 /*
410  * ca_bget_callback()
411  *
412  * WARNING: this returns the new value as a string (dbr_string_t)
413  * (and not as an integer)
414  *
415  * chan R channel identifier
416  * pFunc R pointer to call-back function
417  * pArg R copy of this pointer passed to pFunc
418  */
419 #define ca_bget_callback(chan, pFunc, pArg)\
420 ca_array_get_callback (DBR_STRING, 1u, chan, pFunc, pArg)
421 
422 /*
423  * ca_rget_callback()
424  *
425  * WARNING: this returns the new value as a float (dbr_float_t)
426  *
427  * chan R channel identifier
428  * pFunc R pointer to call-back function
429  * pArg R copy of this pointer passed to pFunc
430  */
431 #define ca_rget_callback(chan, pFunc, pArg)\
432 ca_array_get_callback (DBR_FLOAT, 1u, chan, pFunc, pArg)
433 
434 /*
435  * ca_get_callback()
436  *
437  * type R data type from db_access.h
438  * chan R channel identifier
439  * pFunc R pointer to call-back function
440  * pArg R copy of this pointer passed to pFunc
441  */
442 #define ca_get_callback(type, chan, pFunc, pArg)\
443 ca_array_get_callback (type, 1u, chan, pFunc, pArg)
444 
445 /*
446  * ca_array_get_callback()
447  *
448  * type R data type from db_access.h
449  * count R array element count
450  * chan R channel identifier
451  * pFunc R pointer to call-back function
452  * pArg R copy of this pointer passed to pFunc
453  */
454 LIBCA_API int epicsStdCall ca_array_get_callback
455 (
456  chtype type,
457  unsigned long count,
458  chid chanId,
459  caEventCallBackFunc * pFunc,
460  void * pArg
461 );
462 
463 /************************************************************************/
464 /* Specify a function to be executed whenever significant changes */
465 /* occur to a channel. */
466 /* NOTES: */
467 /* 1) Evid may be omitted by passing a NULL pointer */
468 /* */
469 /* 2) An array count of zero specifies the native db count */
470 /* */
471 /************************************************************************/
472 
473 /*
474  * ca_create_subscription ()
475  *
476  * type R data type from db_access.h
477  * count R array element count
478  * chan R channel identifier
479  * mask R event mask - one of {DBE_VALUE, DBE_ALARM, DBE_LOG}
480  * pFunc R pointer to call-back function
481  * pArg R copy of this pointer passed to pFunc
482  * pEventID W event id written at specified address
483  */
484 LIBCA_API int epicsStdCall ca_create_subscription
485 (
486  chtype type,
487  unsigned long count,
488  chid chanId,
489  long mask,
490  caEventCallBackFunc * pFunc,
491  void * pArg,
492  evid * pEventID
493 );
494 
495 /************************************************************************/
496 /* Remove a function from a list of those specified to run */
497 /* whenever significant changes occur to a channel */
498 /* */
499 /************************************************************************/
500 /*
501  * ca_clear_subscription()
502  *
503  * eventID R event id
504  */
505 LIBCA_API int epicsStdCall ca_clear_subscription
506 (
507  evid eventID
508 );
509 
510 LIBCA_API chid epicsStdCall ca_evid_to_chid ( evid id );
511 
512 
513 /************************************************************************/
514 /* */
515 /* Requested data is not necessarily stable prior to */
516 /* return from called subroutine. Call ca_pend_io() */
517 /* to guarantee that requested data is stable. Call the routine */
518 /* ca_flush_io() to force all outstanding requests to be */
519 /* sent out over the network. Significant increases in */
520 /* performance have been measured when batching several remote */
521 /* requests together into one message. Additional */
522 /* improvements can be obtained by performing local processing */
523 /* in parallel with outstanding remote processing. */
524 /* */
525 /* FLOW OF TYPICAL APPLICATION */
526 /* */
527 /* search() ! Obtain Channel ids */
528 /* . ! " */
529 /* . ! " */
530 /* pend_io ! wait for channels to connect */
531 /* */
532 /* get() ! several requests for remote info */
533 /* get() ! " */
534 /* add_event() ! " */
535 /* get() ! " */
536 /* . */
537 /* . */
538 /* . */
539 /* flush_io() ! send get requests */
540 /* ! optional parallel processing */
541 /* . ! " */
542 /* . ! " */
543 /* pend_io() ! wait for replies from get requests */
544 /* . ! access to requested data */
545 /* . ! " */
546 /* pend_event() ! wait for requested events */
547 /* */
548 /************************************************************************/
549 
550 /************************************************************************/
551 /* These routines wait for channel subscription events and call the */
552 /* functions specified with add_event when events occur. If the */
553 /* timeout is specified as 0 an infinite timeout is assumed. */
554 /* ca_flush_io() is called by this routine. If ca_pend_io () */
555 /* is called when no IO is outstanding then it will return immediately */
556 /* without processing. */
557 /************************************************************************/
558 
559 /*
560  * ca_pend_event()
561  *
562  * timeOut R wait for this delay in seconds
563  */
564 LIBCA_API int epicsStdCall ca_pend_event (ca_real timeOut);
565 #define ca_poll() ca_pend_event(1e-12)
566 
567 /*
568  * ca_pend_io()
569  *
570  * timeOut R wait for this delay in seconds but return early
571  * if all get requests (or search requests with null
572  * connection handler pointer have completed)
573  */
574 LIBCA_API int epicsStdCall ca_pend_io (ca_real timeOut);
575 
576 /* calls ca_pend_io() if early is true otherwise ca_pend_event() is called */
577 LIBCA_API int epicsStdCall ca_pend (ca_real timeout, int early);
578 
579 /*
580  * ca_test_io()
581  *
582  * returns TRUE when get requests (or search requests with null
583  * connection handler pointer) are outstanding
584  */
585 LIBCA_API int epicsStdCall ca_test_io (void);
586 
587 /************************************************************************/
588 /* Send out all outstanding messages in the send queue */
589 /************************************************************************/
590 /*
591  * ca_flush_io()
592  */
593 LIBCA_API int epicsStdCall ca_flush_io (void);
594 
595 
596 /*
597  * ca_signal()
598  *
599  * errorCode R status returned from channel access function
600  * pCtxStr R context string included with error print out
601  */
602 LIBCA_API void epicsStdCall ca_signal
603 (
604  long errorCode,
605  const char *pCtxStr
606 );
607 
608 /*
609  * ca_signal_with_file_and_lineno()
610  * errorCode R status returned from channel access function
611  * pCtxStr R context string included with error print out
612  * pFileStr R file name string included with error print out
613  * lineNo R line number included with error print out
614  *
615  */
616 LIBCA_API void epicsStdCall ca_signal_with_file_and_lineno
617 (
618  long errorCode,
619  const char *pCtxStr,
620  const char *pFileStr,
621  int lineNo
622 );
623 
624 /*
625  * ca_signal_formated()
626  * errorCode R status returned from channel access function
627  * pFileStr R file name string included with error print out
628  * lineNo R line number included with error print out
629  * pFormat R printf dtyle format string (and optional arguments)
630  *
631  */
632 LIBCA_API void epicsStdCall ca_signal_formated (long ca_status, const char *pfilenm,
633  int lineno, const char *pFormat, ...);
634 
635 /*
636  * ca_host_name_function()
637  *
638  * channel R channel identifier
639  *
640  * !!!! this function is _not_ thread safe !!!!
641  */
642 LIBCA_API const char * epicsStdCall ca_host_name (chid channel);
643 /* thread safe version */
644 LIBCA_API unsigned epicsStdCall ca_get_host_name ( chid pChan,
645  char *pBuf, unsigned bufLength );
646 
647 /*
648  * CA_ADD_FD_REGISTRATION
649  *
650  * call their function with their argument whenever
651  * a new fd is added or removed
652  * (for use with a manager of the select system call under UNIX)
653  *
654  * if (opened) then fd was created
655  * if (!opened) then fd was deleted
656  *
657  */
658 typedef void CAFDHANDLER (void *parg, int fd, int opened);
659 
660 /*
661  * ca_add_fd_registration()
662  *
663  * pHandler R pointer to function which is to be called
664  * when an fd is created or deleted
665  * pArg R argument passed to above function
666  */
667 LIBCA_API int epicsStdCall ca_add_fd_registration
668 (
669  CAFDHANDLER *pHandler,
670  void *pArg
671 );
672 
673 
674 /*
675  * CA synch groups
676  *
677  * This facility will allow the programmer to create
678  * any number of synchronization groups. The programmer might then
679  * interleave IO requests within any of the groups. Once The
680  * IO operations are initiated then the programmer is free to
681  * block for IO completion within any one of the groups as needed.
682  */
683 
684 /*
685  * ca_sg_create()
686  *
687  * create a sync group
688  *
689  * pgid W pointer to sync group id that will be written
690  */
691 LIBCA_API int epicsStdCall ca_sg_create (CA_SYNC_GID * pgid);
692 
693 /*
694  * ca_sg_delete()
695  *
696  * delete a sync group
697  *
698  * gid R sync group id
699  */
700 LIBCA_API int epicsStdCall ca_sg_delete (const CA_SYNC_GID gid);
701 
702 /*
703  * ca_sg_block()
704  *
705  * block for IO performed within a sync group to complete
706  *
707  * gid R sync group id
708  * timeout R wait for this duration prior to timing out
709  * and returning ECA_TIMEOUT
710  */
711 LIBCA_API int epicsStdCall ca_sg_block (const CA_SYNC_GID gid, ca_real timeout);
712 
713 /*
714  * ca_sg_test()
715  *
716  * test for sync group IO operations in progress
717  *
718  * gid R sync group id
719  *
720  * returns one of ECA_BADSYNCGRP, ECA_IOINPROGRESS, ECA_IODONE
721  */
722 LIBCA_API int epicsStdCall ca_sg_test (const CA_SYNC_GID gid);
723 
724 /*
725  * ca_sg_reset
726  *
727  * gid R sync group id
728  */
729 LIBCA_API int epicsStdCall ca_sg_reset(const CA_SYNC_GID gid);
730 
731 /*
732  * ca_sg_array_get()
733  *
734  * initiate a get within a sync group
735  * (essentially a ca_array_get() with a sync group specified)
736  *
737  * gid R sync group id
738  * type R data type from db_access.h
739  * count R array element count
740  * chan R channel identifier
741  * pValue W channel value copied to this location
742  */
743 LIBCA_API int epicsStdCall ca_sg_array_get
744 (
745  const CA_SYNC_GID gid,
746  chtype type,
747  unsigned long count,
748  chid chan,
749  void *pValue
750 );
751 
752 #define ca_sg_get(gid, type, chan, pValue) \
753 ca_sg_array_get (gid, type, 1u, chan, pValue)
754 
755 /*
756  * ca_sg_array_put()
757  *
758  * initiate a put within a sync group
759  * (essentially a ca_array_put() with a sync group specified)
760  *
761  * gid R sync group id
762  * type R data type from db_access.h
763  * count R array element count
764  * chan R channel identifier
765  * pValue R new channel value copied from this location
766  */
767 LIBCA_API int epicsStdCall ca_sg_array_put
768 (
769  const CA_SYNC_GID gid,
770  chtype type,
771  unsigned long count,
772  chid chan,
773  const void *pValue
774 );
775 
776 #define ca_sg_put(gid, type, chan, pValue) \
777 ca_sg_array_put (gid, type, 1u, chan, pValue)
778 
779 /*
780  * ca_sg_stat()
781  *
782  * print status of a sync group
783  *
784  * gid R sync group id
785  */
786 LIBCA_API int epicsStdCall ca_sg_stat (CA_SYNC_GID gid);
787 
788 LIBCA_API void epicsStdCall ca_dump_dbr (chtype type, unsigned count, const void * pbuffer);
789 
790 
791 /*
792  * ca_v42_ok()
793  *
794  * Put call back is available if the CA server is on version is 4.2
795  * or higher.
796  *
797  * chan R channel identifier
798  *
799  * (returns true or false)
800  */
801 LIBCA_API int epicsStdCall ca_v42_ok (chid chan);
802 
803 /*
804  * ca_version()
805  *
806  * returns the CA version string
807  */
808 LIBCA_API const char * epicsStdCall ca_version (void);
809 
810 /*
811  * ca_replace_printf_handler ()
812  *
813  * for apps that want to change where ca formatted
814  * text output goes
815  *
816  * use two ifdef's for trad C compatibility
817  *
818  * ca_printf_func R pointer to new function called when
819  * CA prints an error message
820  */
821 #ifndef CA_DONT_INCLUDE_STDARGH
822 typedef int caPrintfFunc (const char *pformat, va_list args);
823 LIBCA_API int epicsStdCall ca_replace_printf_handler (
824  caPrintfFunc *ca_printf_func
825 );
826 #endif /*CA_DONT_INCLUDE_STDARGH*/
827 
828 /*
829  * (for testing purposes only)
830  */
831 LIBCA_API unsigned epicsStdCall ca_get_ioc_connection_count (void);
832 LIBCA_API int epicsStdCall ca_preemtive_callback_is_enabled (void);
833 LIBCA_API void epicsStdCall ca_self_test (void);
834 LIBCA_API unsigned epicsStdCall ca_beacon_anomaly_count (void);
835 LIBCA_API unsigned epicsStdCall ca_search_attempts (chid chan);
836 LIBCA_API double epicsStdCall ca_beacon_period (chid chan);
837 LIBCA_API double epicsStdCall ca_receive_watchdog_delay (chid chan);
838 
839 /*
840  * used when an auxiliary thread needs to join a CA client context started
841  * by another thread
842  */
843 LIBCA_API struct ca_client_context * epicsStdCall ca_current_context ();
844 LIBCA_API int epicsStdCall ca_attach_context ( struct ca_client_context * context );
845 
846 
847 LIBCA_API int epicsStdCall ca_client_status ( unsigned level );
848 LIBCA_API int epicsStdCall ca_context_status ( struct ca_client_context *, unsigned level );
849 
850 /*
851  * deprecated
852  */
853 #define ca_build_channel(NAME,XXXXX,CHIDPTR,YYYYY)\
854 ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0)
855 #define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\
856 ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0)
857 LIBCA_API int epicsStdCall ca_build_and_connect
858  ( const char *pChanName, chtype, unsigned long,
859  chid * pChanID, void *, caCh * pFunc, void * pArg );
860 #define ca_search(pChanName, pChanID)\
861 ca_search_and_connect (pChanName, pChanID, 0, 0)
862 LIBCA_API int epicsStdCall ca_search_and_connect
863  ( const char * pChanName, chid * pChanID,
864  caCh *pFunc, void * pArg );
865 LIBCA_API int epicsStdCall ca_channel_status (epicsThreadId tid);
866 LIBCA_API int epicsStdCall ca_clear_event ( evid eventID );
867 #define ca_add_event(type,chan,pFunc,pArg,pEventID)\
868 ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID)
869 #define ca_add_delta_event(TYPE,CHID,ENTRY,ARG,DELTA,EVID)\
870  ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,DELTA,DELTA,0.0,EVID)
871 #define ca_add_general_event(TYPE,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\
872 ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)
873 #define ca_add_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\
874 ca_add_masked_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID, DBE_VALUE | DBE_ALARM)
875 LIBCA_API int epicsStdCall ca_add_masked_array_event
876  ( chtype type, unsigned long count, chid chanId, caEventCallBackFunc * pFunc,
877  void * pArg, ca_real p_delta, ca_real n_delta, ca_real timeout,
878  evid * pEventID, long mask );
879 
880 /*
881  * defunct
882  */
883 LIBCA_API int epicsStdCall ca_modify_user_name ( const char *pUserName );
884 LIBCA_API int epicsStdCall ca_modify_host_name ( const char *pHostName );
885 
886 #ifdef __cplusplus
887 }
888 #endif
889 
890 /*
891  * no additions below this endif
892  */
893 #endif /* ifndef INC_cadef_H */
894 
Definition: cadef.h:60
C++ and C descriptions for a thread.
Definition: cadef.h:85