ia64/xen-unstable

view tools/xcs/xcs_proto.h @ 3966:0b9ff7354a95

bitkeeper revision 1.1236.1.47 (4225ff68LvKUt73k78dKjnXxsnQt7A)

Fix tools build. Clean up barrier defs.
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
author kaf24@scramble.cl.cam.ac.uk
date Wed Mar 02 18:01:12 2005 +0000 (2005-03-02)
parents d8cf61e99a52
children a6914c2c15cf 2101e98387dd
line source
1 /* xcs_proto.h
2 *
3 * protocol interfaces for the control interface switch (xcs).
4 *
5 * (c) 2004, Andrew Warfield
6 *
7 */
9 #ifndef __XCS_PROTO_H__
10 #define __XCS_PROTO_H__
12 #define XCS_SUN_PATH "/var/xen/xcs_socket"
14 /* xcs message types: */
15 #define XCS_CONNECT_CTRL 0 /* This is a control connection. */
16 #define XCS_CONNECT_DATA 1 /* This is a data connection. */
17 #define XCS_CONNECT_BYE 2 /* Terminate a session. */
18 #define XCS_MSG_BIND 3 /* Register for a message type. */
19 #define XCS_MSG_UNBIND 4 /* Unregister for a message type. */
20 #define XCS_VIRQ_BIND 5 /* Register for a virq. */
21 #define XCS_MSG_WRITELOCK 6 /* Writelock a (dom,type) pair. */
22 #define XCS_CIF_NEW_CC 7 /* Create a new control channel. */
23 #define XCS_CIF_FREE_CC 8 /* Create a new control channel. */
24 #define XCS_REQUEST 9 /* This is a request message. */
25 #define XCS_RESPONSE 10 /* this is a response Message. */
26 #define XCS_VIRQ 11 /* this is a virq notification. */
28 /* xcs result values: */
29 #define XCS_RSLT_OK 0
30 #define XCS_RSLT_FAILED 1 /* something bad happened. */
31 #define XCS_RSLT_ARECONNECTED 2 /* attempt to over connect. */
32 #define XCS_RSLT_BADSESSION 3 /* request for unknown session id. */
33 #define XCS_RSLT_NOSESSION 4 /* tried to do something before NEW. */
34 #define XCS_RSLT_CONINUSE 5 /* Requested connection is taken. */
35 #define XCS_RSLT_BADREQUEST 6 /* Request message didn't validate. */
37 /* Binding wildcards */
38 #define PORT_WILDCARD 0xefffffff
39 #define TYPE_WILDCARD 0xffff
40 #define TYPE_VIRQ 0xfffe
42 typedef struct {
43 u32 session_id;
44 } xcs_connect_msg_t;
46 typedef struct {
47 int port;
48 u16 type;
49 } xcs_bind_msg_t;
51 typedef struct {
52 int port;
53 u16 virq;
54 } xcs_virq_msg_t;
56 typedef struct {
57 u32 dom;
58 int local_port;
59 int remote_port;
60 } xcs_interface_msg_t;
62 typedef struct {
63 u32 remote_dom;
64 int local_port;
65 control_msg_t msg;
66 } xcs_control_msg_t;
68 typedef struct {
69 u32 type;
70 u32 result;
71 union {
72 xcs_connect_msg_t connect; /* These are xcs ctrl message types */
73 xcs_bind_msg_t bind;
74 xcs_virq_msg_t virq;
75 xcs_interface_msg_t interface;
77 xcs_control_msg_t control; /* These are xcs data message types */
78 } PACKED u;
79 } xcs_msg_t;
81 /* message validation macros. */
82 #define PORT_VALID(_p) \
83 ( (((_p) >= 0) && ((_p) < NR_EVENT_CHANNELS)) \
84 || ((_p) == PORT_WILDCARD) )
86 #define TYPE_VALID(_t) \
87 ( ((_t) < 256) \
88 || ((_t) == TYPE_VIRQ) \
89 || ((_t) == TYPE_WILDCARD) )
91 #define BIND_MSG_VALID(_b) \
92 ( PORT_VALID((_b)->port) && TYPE_VALID((_b)->type) )
94 /* Port is overwritten, and we don't currently validate the requested virq. */
95 #define VIRQ_MSG_VALID(_v) ( 1 )
97 /* Interfaces may return with ports of -1, but may not be requested as such */
98 #define INTERFACE_MSG_VALID(_i) \
99 ( PORT_VALID((_i)->local_port) && PORT_VALID((_i)->remote_port) )
101 #endif /* __XCS_PROTO_H__ */