]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - linux/include/INetworkTransport.h
Instance converter methods need to be inline functions.
[ipc/ipcdev.git] / linux / include / INetworkTransport.h
1 /*
2  * Copyright (c) 2014-2015 Texas Instruments Incorporated - http://www.ti.com
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /*
34  *  ======== INetworkTransport.h ========
35  */
37 #ifndef INETWORKTRANSPORT_H
38 #define INETWORKTRANSPORT_H
40 #include <ITransport.h>
43 /*
44  *  ======== INetworkTransport_Handle ========
45  *  Opaque handle to interface instance object
46  */
47 typedef struct INetworkTransport_Object *INetworkTransport_Handle;
49 /*
50  *  ======== INetworkTransport_TypeId ========
51  *  Unique identifier for this interface
52  */
53 #define INetworkTransport_TypeId 0x03
55 /*
56  *  ======== INetworkTransport_Fxns ========
57  *  Interface virtual function table
58  */
59 typedef struct INetworkTransport_Fxns {
60     Int (*bind)(void *handle, UInt32 queueId);
61     Int (*unbind)(void *handle, UInt32 queueId);
62     Bool (*put)(void *handle, Ptr msg);
63 } INetworkTransport_Fxns;
65 /*
66  *  ======== INetworkTransport_Object ========
67  *  Abstract instance object
68  */
69 typedef struct INetworkTransport_Object {
70     ITransport_Object base;             /* inheritance */
71     INetworkTransport_Fxns *fxns;       /* virtual functions */
72 } INetworkTransport_Object;
74 /*
75  *  ======== INetworkTransport_bind ========
76  *  Instance function stub
77  */
78 static inline
79 Bool INetworkTransport_bind(INetworkTransport_Handle inst, UInt32 queueId)
80 {
81     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
82     return (obj->fxns->bind((void *)inst, queueId));
83 }
85 /*
86  *  ======== INetworkTransport_unbind ========
87  *  Instance function stub
88  */
89 static inline
90 Bool INetworkTransport_unbind(INetworkTransport_Handle inst, UInt32 queueId)
91 {
92     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
93     return (obj->fxns->unbind((void *)inst, queueId));
94 }
96 /*
97  *  ======== INetworkTransport_put ========
98  *  Instance function stub
99  */
100 static inline
101 Bool INetworkTransport_put(INetworkTransport_Handle inst, Ptr msg)
103     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
104     return (obj->fxns->put((void *)inst, msg));
107 /*
108  *  ======== INetworkTransport_upCast ========
109  *  Instance converter
110  */
111 static inline
112 ITransport_Handle INetworkTransport_upCast(INetworkTransport_Handle inst)
114     INetworkTransport_Object *obj = (INetworkTransport_Object *)inst;
115     return ((ITransport_Handle)&obj->base);
118 /*
119  *  ======== INetworkTransport_downCast ========
120  *  Instance converter
121  */
122 static inline
123 INetworkTransport_Handle INetworkTransport_downCast(ITransport_Handle base)
125     return ((INetworkTransport_Handle)base);
128 #endif /* INETWORKTRANSPORT_H */