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