EPICS Base
7.0.8.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
caProto.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
* Author Jeffrey O. Hill
13
*
[email protected]
14
* 505 665 1831
15
*/
16
17
#ifndef INC_caProto_H
18
#define INC_caProto_H
19
20
// Pick up definition of IPPORT_USERRESERVED
21
#include <
osiSock.h
>
22
23
#define capStrOf(A) #A
24
#define capStrOfX(A) capStrOf ( A )
25
26
/*
27
* CA protocol revision
28
* TCP/UDP port number (bumped each major protocol change)
29
*/
30
#define CA_MAJOR_PROTOCOL_REVISION 4
31
#define CA_VERSION_STRING( MINOR_REVISION ) \
32
( capStrOfX ( CA_MAJOR_PROTOCOL_REVISION ) "." capStrOfX ( MINOR_REVISION ) )
33
#define CA_UKN_MINOR_VERSION 0u
/* unknown minor version */
34
#define CA_MINIMUM_SUPPORTED_VERSION 4u
35
# define CA_VSUPPORTED(MINOR) ((MINOR)>=CA_MINIMUM_SUPPORTED_VERSION)
36
# define CA_V41(MINOR) ((MINOR)>=1u)
37
# define CA_V42(MINOR) ((MINOR)>=2u)
38
# define CA_V43(MINOR) ((MINOR)>=3u)
39
# define CA_V44(MINOR) ((MINOR)>=4u)
40
# define CA_V45(MINOR) ((MINOR)>=5u)
41
# define CA_V46(MINOR) ((MINOR)>=6u)
42
# define CA_V47(MINOR) ((MINOR)>=7u)
43
# define CA_V48(MINOR) ((MINOR)>=8u)
44
# define CA_V49(MINOR) ((MINOR)>=9u)
/* large arrays, dispatch priorities */
45
# define CA_V410(MINOR) ((MINOR)>=10u)
/* beacon counter */
46
# define CA_V411(MINOR) ((MINOR)>=11u)
/* sequence numbers in UDP version command */
47
# define CA_V412(MINOR) ((MINOR)>=12u)
/* TCP-based search requests */
48
# define CA_V413(MINOR) ((MINOR)>=13u)
/* Allow zero length in requests. */
49
50
/*
51
* These port numbers are only used if the CA repeater and
52
* CA server port numbers cant be obtained from the EPICS
53
* environment variables "EPICS_CA_REPEATER_PORT" and
54
* "EPICS_CA_SERVER_PORT"
55
*/
56
#define CA_PORT_BASE IPPORT_USERRESERVED + 56U
57
#define CA_SERVER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u)
58
#define CA_REPEATER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u+1u)
59
60
/*
61
* 1500 (max of Ethernet and 802.{2,3} MTU) - 20(IP) - 8(UDP)
62
* (the MTU of Ethernet is currently independent of its speed variant)
63
*/
64
#define ETHERNET_MAX_UDP ( 1500u - 20u - 8u )
65
#define MAX_UDP_RECV ( 0xffff + 16u )
/* allow large frames to be received in the future */
66
#define MAX_UDP_SEND 1024u
/* original MAX_UDP */
67
#define MAX_TCP ( 1024 * 16u )
/* so waveforms fit */
68
#define MAX_MSG_SIZE ( MAX_TCP )
/* the larger of tcp and udp max */
69
70
#define CA_PROTO_PRIORITY_MIN 0u
71
#define CA_PROTO_PRIORITY_MAX 99u
72
73
/*
74
* architecture independent types
75
*
76
* (so far this works on all archs we have ported to)
77
*/
78
typedef
unsigned
char
ca_uint8_t;
79
typedef
unsigned
short
ca_uint16_t;
80
typedef
unsigned
int
ca_uint32_t;
81
typedef
float
ca_float32_t;
82
typedef
ca_uint32_t caResId;
83
84
#define ca_uint32_max 0xffffffff
85
86
/* values for m_cmmd */
87
#define CA_PROTO_VERSION 0u
/* set minor version and priority (used to be NOOP cmd) */
88
#define CA_PROTO_EVENT_ADD 1u
/* add an event */
89
#define CA_PROTO_EVENT_CANCEL 2u
/* cancel an event */
90
#define CA_PROTO_READ 3u
/* read and return a channel value*/
91
#define CA_PROTO_WRITE 4u
/* write a channel value */
92
#define CA_PROTO_SNAPSHOT 5u
/* snapshot of the system */
93
#define CA_PROTO_SEARCH 6u
/* IOC channel search */
94
#define CA_PROTO_BUILD 7u
/* build - obsolete */
95
#define CA_PROTO_EVENTS_OFF 8u
/* flow control */
96
#define CA_PROTO_EVENTS_ON 9u
/* flow control */
97
#define CA_PROTO_READ_SYNC 10u
/* purge old reads */
98
#define CA_PROTO_ERROR 11u
/* an operation failed */
99
#define CA_PROTO_CLEAR_CHANNEL 12u
/* free chan resources */
100
#define CA_PROTO_RSRV_IS_UP 13u
/* CA server has joined the net */
101
#define CA_PROTO_NOT_FOUND 14u
/* channel not found */
102
#define CA_PROTO_READ_NOTIFY 15u
/* add a one shot event */
103
#define CA_PROTO_READ_BUILD 16u
/* read and build - obsolete */
104
#define REPEATER_CONFIRM 17u
/* registration confirmation */
105
#define CA_PROTO_CREATE_CHAN 18u
/* client creates channel in server */
106
#define CA_PROTO_WRITE_NOTIFY 19u
/* notify after write chan value */
107
#define CA_PROTO_CLIENT_NAME 20u
/* CA V4.1 identify client */
108
#define CA_PROTO_HOST_NAME 21u
/* CA V4.1 identify client */
109
#define CA_PROTO_ACCESS_RIGHTS 22u
/* CA V4.2 asynch access rights chg */
110
#define CA_PROTO_ECHO 23u
/* CA V4.3 connection verify */
111
#define REPEATER_REGISTER 24u
/* register for repeater fan out */
112
#define CA_PROTO_SIGNAL 25u
/* knock the server out of select */
113
#define CA_PROTO_CREATE_CH_FAIL 26u
/* unable to create chan resource in server */
114
#define CA_PROTO_SERVER_DISCONN 27u
/* server deletes PV (or channel) */
115
116
#define CA_PROTO_LAST_CMMD CA_PROTO_SERVER_DISCONN
117
118
/*
119
* for use with search and not_found (if search fails and
120
* its not a broadcast tell the client to look elsewhere)
121
*/
122
#define DOREPLY 10u
123
#define DONTREPLY 5u
124
125
/*
126
* for use with the m_dataType field in UDP messages emitted by servers
127
*/
128
#define sequenceNoIsValid 1
129
130
/* size of object in bytes rounded up to nearest oct word */
131
#define OCT_ROUND(A) (((A)+7)/8)
132
#define OCT_SIZEOF(A) (OCT_ROUND(sizeof(A)))
133
134
/* size of object in bytes rounded up to nearest long word */
135
#define QUAD_ROUND(A) ((A)+3)/4)
136
#define QUAD_SIZEOF(A) (QUAD_ROUND(sizeof(A)))
137
138
/* size of object in bytes rounded up to nearest short word */
139
#define BI_ROUND(A) (((A)+1)/2)
140
#define BI_SIZEOF(A) (BI_ROUND(sizeof(A)))
141
142
/*
143
* For communicating access rights to the clients
144
*
145
* (placed in m_available hdr field of CA_PROTO_ACCESS_RIGHTS cmmd
146
*/
147
#define CA_PROTO_ACCESS_RIGHT_READ (1u<<0u)
148
#define CA_PROTO_ACCESS_RIGHT_WRITE (1u<<1u)
149
150
/*
151
* All structures passed in the protocol must have individual
152
* fields aligned on natural boundaries.
153
*
154
* NOTE: all structures declared in this file must have a
155
* byte count which is evenly divisible by 8 matching
156
* the largest atomic data type in db_access.h.
157
*/
158
#define CA_MESSAGE_ALIGN(A) (OCT_ROUND(A)<<3u)
159
160
/*
161
* the common part of each message sent/recv by the
162
* CA server.
163
*/
164
typedef
struct
ca_hdr {
165
ca_uint16_t m_cmmd;
/* operation to be performed */
166
ca_uint16_t m_postsize;
/* size of payload */
167
ca_uint16_t m_dataType;
/* operation data type */
168
ca_uint16_t m_count;
/* operation data count */
169
ca_uint32_t m_cid;
/* channel identifier */
170
ca_uint32_t m_available;
/* protocol stub dependent */
171
}
caHdr
;
172
173
/*
174
* for monitor (event) message extension
175
*/
176
struct
mon_info
{
177
ca_float32_t m_lval;
/* low delta */
178
ca_float32_t m_hval;
/* high delta */
179
ca_float32_t m_toval;
/* period between samples */
180
ca_uint16_t m_mask;
/* event select mask */
181
ca_uint16_t m_pad;
/* extend to 32 bits */
182
};
183
184
/*
185
* PV names greater than this length assumed to be invalid
186
*/
187
#define unreasonablePVNameSize 500u
188
189
#endif
/* ifndef INC_caProto_H */
190
caHdr
Definition:
caProto.h:164
osiSock.h
Platform independent socket support library API.
mon_info
Definition:
caProto.h:176
Generated on Sun Jun 30 2024 13:46:57 for EPICS Base by
1.8.5