EPICS Base
7.0.6.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
dbNotify.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
/* dbNotify.h */
11
12
#ifndef INCdbNotifyh
13
#define INCdbNotifyh
14
15
#include "dbCoreAPI.h"
16
#include "
ellLib.h
"
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
22
struct
dbCommon
;
23
struct
processNotify
;
24
25
typedef
struct
ellCheckNode
{
26
ELLNODE
node;
27
int
isOnList;
28
}
ellCheckNode
;
29
30
typedef
enum
{
31
processRequest,
32
putProcessRequest,
33
processGetRequest,
34
putProcessGetRequest
35
} notifyRequestType;
36
37
typedef
enum
{
38
putDisabledType,
39
putFieldType,
40
putType
41
} notifyPutType;
42
43
typedef
enum
{
44
getFieldType,
45
getType
/* FIXME: Never used? */
46
} notifyGetType;
47
48
typedef
enum
{
49
notifyOK,
50
notifyCanceled,
51
notifyError,
52
notifyPutDisabled
53
} notifyStatus;
54
55
typedef
struct
processNotify
{
56
/* following fields are for private use by dbNotify implementation */
57
ellCheckNode
restartNode;
58
void
*pnotifyPvt;
59
/* The following fields are set by dbNotify. */
60
notifyStatus status;
61
int
wasProcessed;
/* (0,1) => (no,yes) */
62
/*The following members are set by user*/
63
notifyRequestType requestType;
64
struct
dbChannel
*chan;
/*dbChannel*/
65
int (*putCallback)(
struct
processNotify
*,notifyPutType type);
66
void (*getCallback)(
struct
processNotify
*,notifyGetType type);
67
void (*doneCallback)(
struct
processNotify
*);
68
void
*usrPvt;
/*for private use of user*/
69
}
processNotify
;
70
71
72
/* dbProcessNotify and dbNotifyCancel are called by user*/
73
DBCORE_API
void
dbProcessNotify(
processNotify
*pprocessNotify);
74
DBCORE_API
void
dbNotifyCancel(
processNotify
*pprocessNotify);
75
76
/* dbProcessNotifyInit called by iocInit */
77
DBCORE_API
void
dbProcessNotifyInit(
void
);
78
DBCORE_API
void
dbProcessNotifyExit(
void
);
79
80
/*dbNotifyAdd called by dbScanPassive and dbScanLink*/
81
DBCORE_API
void
dbNotifyAdd(
82
struct
dbCommon
*pfrom,
struct
dbCommon
*pto);
83
/*dbNotifyCompletion called by recGblFwdLink or dbAccess*/
84
DBCORE_API
void
dbNotifyCompletion(
struct
dbCommon
*precord);
85
86
/* db_put_process defined here since it requires dbNotify.
87
* src_type is the old DBR type
88
* This is called by a dbNotify putCallback that uses oldDbr types
89
*/
90
DBCORE_API
int
db_put_process(
91
processNotify
*
processNotify
,notifyPutType type,
92
int
src_type,
const
void
*psrc,
int
no_elements);
93
94
/* dbtpn is test routine for dbNotify putProcessRequest */
95
DBCORE_API
long
dbtpn(
char
*recordname,
char
*
value
);
96
97
/* dbNotifyDump is an INVASIVE debug utility. Don't use this needlessly*/
98
DBCORE_API
int
dbNotifyDump(
void
);
99
100
/* This module provides code to handle process notify.
101
* client code semantics are:
102
* 1) The client code allocates storage for a processNotify structure.
103
* This structure can be used for multiple calls to dbProcessNotify.
104
* The client is responsible for setting the following fields :
105
* requestType - The type of request.
106
* chan - This is typically set via a call to dbChannelCreate.
107
* putCallback - If requestType is putProcessRequest or putProcessGetRequest
108
* getCallback - If request is processGetRequest or putProcessGetRequest
109
* doneCallback - Must be set
110
* usrPvt - For exclusive use of client. dbNotify does not access this field
111
* 2) The client calls dbProcessNotify.
112
* 3) putCallback is called after dbNotify has claimed the record instance
113
* but before a potential process is requested.
114
* The putCallback MUST issue the correct put request
115
* specified by notifyPutType
116
* 4) getCallback is called after a possible process is complete
117
* (including asynchronous completion) but before dbNotify has
118
* released the record.
119
* The getCallback MUST issue the correct get request
120
* specified by notifyGetType
121
* 5) doneCallback is called when dbNotify has released the record.
122
* The client can issue a new dbProcessNotify request from
123
* doneCallback or anytime after doneCallback returns.
124
* 6) The client can call dbNotifyCancel at any time.
125
* If a dbProcessNotify is active, dbNotifyCancel will not return until
126
* the dbNotifyRequest is actually canceled. The client must be prepared
127
* for a callback to be called while dbNotifyCancel is active.
128
*
129
* dbProcessNotify handles the semantics of record locking and deciding
130
* if a process request is issued and also calls the client callbacks.
131
*
132
* A process request is issued if any of the following is true.
133
* 1) The requester has issued a process request and record is passive.
134
* 2) The requester is doing a put, the record is passive, and either
135
* a) The field description is process passive.
136
* b) The field is PROC.
137
* 3) The requester has requested processGet and the record is passive.
138
*
139
* iocInit calls processNotifyInit.
140
*
141
* The other global routines (dbNotifyAdd and dbNotifyCompletion) are called by:
142
*
143
* dbAccess.c
144
* dbScanPassive and dbScanLink
145
* call dbNotifyAdd just before calling dbProcess
146
* dbProcess
147
* Calls dbNotifyCompletion if dbProcess does not call process
148
* Unless pact is already true.
149
* recGbl
150
* recGblFwdLink calls dbNotifyCompletion
151
*
152
* Two fields in dbCommon are used for put notify.
153
* ppn pointer to processNotify
154
* If a record is part of a put notify group,
155
* This field is the address of the associated processNotify.
156
* As soon as a record completes processing the field is set NULL
157
* ppnr pointer to processNotifyRecord, which is a private structure
158
* owned by dbNotify.
159
* dbNotify is responsible for this structure.
160
*
161
*/
162
#ifdef __cplusplus
163
}
164
#endif
165
166
#endif
/*INCdbNotifyh*/
167
value
Definition:
link.h:175
dbChannel
Definition:
dbChannel.h:54
ELLNODE
List node type.
Definition:
ellLib.h:46
dbCommon
Declaration of dbCommon.
Definition:
dbCommon.h:18
ellLib.h
A doubly-linked list library.
processNotify
Definition:
dbNotify.h:55
ellCheckNode
Definition:
dbNotify.h:25
Generated on Wed Oct 6 2021 20:58:13 for EPICS Base by
1.8.5