4 * Implements an architecture independant Capability Service API
6 * $DragonFly: src/sys/sys/caps.h,v 1.1 2003/11/24 21:15:54 dillon Exp $
13 #include <sys/types.h>
15 #ifndef _SYS_MSGPORT_H_
16 #include <sys/msgport.h>
19 #define CAPS_USER 0x00000001
20 #define CAPS_GROUP 0x00000002
21 #define CAPS_WORLD 0x00000004
22 #define CAPS_EXCL 0x00000008
23 #define CAPS_ANYCLIENT (CAPS_USER|CAPS_GROUP|CAPS_WORLD)
24 #define CAPS_WCRED 0x00000010 /* waiting for cred */
27 * caps_type associated with caps_port:
29 * CAPT_CLIENT port returned to client representing connection to
31 * CAPT_SERVICE port returned to service representing namespace
32 * CAPT_REMOTE temporary port used by service to represent
33 * client connections to service (set as replyport for
37 enum caps_type { CAPT_UNKNOWN, CAPT_CLIENT, CAPT_SERVICE, CAPT_REMOTE };
39 #define CAPS_MAXGROUPS 16
44 typedef struct caps_port *caps_port_t;
52 gid_t groups[CAPS_MAXGROUPS];
56 struct lwkt_port lport;
57 caps_port_t server; /* if CAPT_REMOTE, pointer to server */
59 int kqfd; /* kqueue to collect active connects */
60 int lfd; /* server: listening on (server) */
61 int cfd; /* client/remote connection fd */
63 TAILQ_HEAD(, caps_port) clist; /* server: client client connections */
64 TAILQ_ENTRY(caps_port) centry;
65 TAILQ_HEAD(, lwkt_msg) wlist; /* queue of outgoing messages */
66 TAILQ_HEAD(, lwkt_msg) mlist; /* written message waiting for reply */
67 struct lwkt_msg rmsg_static;
68 lwkt_msg_t rmsg; /* read message in progress */
69 struct caps_cred cred; /* cred of owner of port */
70 int rbytes; /* read in progress byte count */
71 int wbytes; /* write in progress byte count */
74 #define CAPPF_WAITCRED 0x0001
75 #define CAPPF_ONLIST 0x0002
76 #define CAPPF_WREQUESTED 0x0004 /* write event requested */
77 #define CAPPF_SHUTDOWN 0x0008 /* terminated/failed */
79 #define CAPMSG_MAXSIZE (1024+64*1024)
84 caps_port_t caps_service(const char *name, gid_t gid, mode_t modes, int flags);
85 caps_port_t caps_client(const char *name, uid_t uid, int flags);
88 * Temporary hack until LWKT threading is integrated.
90 void *caps_client_waitreply(caps_port_t port, lwkt_msg_t msg);