1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     osl_Mbuf.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 12449 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_NET_OSL_OSL_MBUFINDEXED_H_
17 #define NN_NET_OSL_OSL_MBUFINDEXED_H_
18 
19 typedef u32 nnnetOslMbufIndex;
20 
21 /* mbuf for inter-process */
22 typedef struct nnnetOslMbufIndexed
23 {
24     nnnetOslMbufIndex   m_nextIndex;                    /**< Next cluster index */
25     nnnetOslMbufIndex   m_prevIndex;                    /**< Previous cluster index */
26     void*               m_reserved;
27     u32                 m_pad;
28 } nnnetOslMbufIndexedHead;
29 
30 #ifdef __cplusplus
31 
32 namespace nn {
33 namespace net {
34 namespace osl {
35 
36 class Mbuf;
37 class MbufIndexed : public nnnetOslMbufIndexed
38 {
39 public:
40     friend class MbufPool;
41     typedef nnnetOslMbufIndex Index;
42     static const u32    INVALID_INDEX   = 0xffffffff;
43 
44     static MbufIndexed* ConvertToIndexed(Mbuf* pMbuf);
45     static Mbuf* ConvertFromIndex(Index index);
46 
SetNext(Index index)47     void SetNext(Index index)
48     {
49         m_nextIndex = index;
50     }
51 
SetPrevious(Index index)52     void SetPrevious(Index index)
53     {
54         m_prevIndex = index;
55     }
56 
57     Index GetIndex(void) const;
58 
59     void Dump(void) const;
60 };
61 
62 }
63 }
64 } // namespace nn::net::osl
65 
66 #endif // __cplusplus
67 
68 #endif // NN_NET_OSL_OSL_MBUFINDEXED_H_
69