port.h (1359B)
1 /* Copyright 1998-1999, Brian J. Swetland. All rights reserved. 2 ** Distributed under the terms of the OpenBLT License 3 */ 4 5 #ifndef _PORT_H_ 6 #define _PORT_H_ 7 8 #include "resource.h" 9 #include "types.h" 10 11 #define PORT_OPT_NOWAIT 1 12 #define PORT_OPT_SETRESTRICT 2 13 #define PORT_OPT_SETDEFAULT 3 14 #define PORT_OPT_SLAVE 4 15 16 typedef struct __chain_t 17 { 18 struct __chain_t *next; 19 } chain_t; 20 21 typedef struct __message_t { 22 struct __message_t *next; 23 uint32 size; 24 uint32 code; 25 int from_port; 26 int to_port; 27 void *data; 28 } message_t; 29 30 struct __port_t 31 { 32 resource_t rsrc; 33 34 int msgcount; /* number of messages waiting in the queue */ 35 int slaved; /* deliver my messages to a master port */ 36 message_t *first; /* head of the queue */ 37 message_t *last; /* tail of the queue */ 38 int refcount; /* counts owner and any slaved ports */ 39 int nowait; /* do we block on an empty queue? */ 40 int restrict; /* is port public or private? */ 41 resource_t *sendqueue; 42 }; 43 44 int port_create(int restrict, const char *name); 45 int port_destroy(int port); 46 uint32 port_option(uint32 port, uint32 opt, uint32 arg); 47 ssize_t port_send(int src, int dst, void *data, size_t len, uint32 code); 48 ssize_t port_recv(int dst, int *src, void *data, size_t max, uint32 *code); 49 50 #endif