956fc67c39b905ce4fbf8a4baee54ae9a1382f15
[ipc/ipcdev.git] / linux / include / INetworkTransport.h
1 /*
2  *  ======== INetworkTransport.h ========
3  */
5 #ifndef INETWORKTRANSPORT_H
6 #define INETWORKTRANSPORT_H
8 #include <ITransport.h>
10 /* opaque instance handle */
11 typedef struct INetworkTransport_Object *INetworkTransport_Handle;
13 #define INetworkTransport_TypeId 0x03
15 /* virtual functions */
16 typedef struct INetworkTransport_Fxns {
17     Int (*bind)(void *handle, UInt32 queueId);
18     Int (*unbind)(void *handle, UInt32 queueId);
19     Bool (*put)(void *handle, Ptr msg);
20 } INetworkTransport_Fxns;
22 /* abstract instance object */
23 typedef struct INetworkTransport_Object {
24     ITransport_Object base;             /* inheritance */
25     INetworkTransport_Fxns *fxns;       /* virtual functions */
26 } INetworkTransport_Object;
28 /* function stubs */
29 static inline
30 Bool INetworkTransport_bind(INetworkTransport_Handle inst, UInt32 queueId)
31 {
32     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
33     return obj->fxns->bind((void *)inst, queueId);
34 }
36 static inline
37 Bool INetworkTransport_unbind(INetworkTransport_Handle inst, UInt32 queueId)
38 {
39     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
40     return obj->fxns->unbind((void *)inst, queueId);
41 }
43 static inline
44 Bool INetworkTransport_put(INetworkTransport_Handle inst, Ptr msg)
45 {
46     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
47     return obj->fxns->put((void *)inst, msg);
48 }
50 /* instance convertors */
51 ITransport_Handle INetworkTransport_upCast(INetworkTransport_Handle inst)
52 {
53     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
54     return (ITransport_Handle)&obj->base;
55 }
57 INetworkTransport_Handle INetworkTransport_downCast(ITransport_Handle base)
58 {
59     return (INetworkTransport_Handle)base;
60 }
62 #endif /* INETWORKTRANSPORT_H */