versadac  1
versadac - Scalable Recorder Firmware
mrp_domain.h
1 /***************************************************************************************
2  *********** Copyright 2005 Zurich University of Applied Sciences / InES **************
3  ***************************************************************************************
4  **
5  ** File : mrp_domain.h
6  **
7  ** Description : This file provides the class Domain for a MRC which represents
8  ** a MRP Domain
9  **
10  ***************************************************************************************
11  ** Department : Institute of Embedded Systems
12  ** Project : MRP
13  ** Modul : MRP_Domain_T
14  ** Author : Christian Schaer
15  ** Contact : scc@zhwin.ch
16  ** Date : 10.04.2006
17  ****************************** Modifications ******************************************
18  **
19  ** Date : Who : Comment :
20  ** 10.05.06 scc initial release
21  **************************************************************************************/
22 /* $Workfile:: mrp_domain.h $*/
23 /* $Revision:: 3 $*/
24 /* $Date:: 16/12/10 14:44 $*/
25 
26 #ifndef MRP_RING_H
27 #define MRP_RING_H
28 
29 
30 /***********************************************************************/
31 /*** Header Files Includes ***/
32 /***********************************************************************/
33 
34 #include "mrp_pkg.h"
35 #include "mrp_protocolmachine.h"
36 #include "mrp_protocolevent.h"
37 #include "mrp_pduframes.h"
38 #include "mrp_timer.h"
39 
40 
41 
42 typedef enum MRPTimers {
43  MRP_UP_TIMER,
44  MRP_DOWN_TIMER,
45  MRP_FDB_CLEAR_TIMER,
46  MRP_NO_TIMERS
47 } MRPTimers;
48 
49 /**********************************************************************/
50 /*** class MRP_Domain_T ***/
51 /**********************************************************************/
52 
53 struct MRP_Domain_T
54 {
55  MRP_Environment_T* mrp_environment_ptr_;
56  MRP_ProtocolMachine_T mrp_protocolmachine_;
57  MRP_PDUFrames_T mrp_pduframes_;
58  MRP_Timer_T mrp_timer_[ MRP_NO_TIMERS ]; /* This array contains all MRP specific timers */
59 
60 
63  MRPRoleState expected_role_state_;
64  Unsigned16 ring_port_1_id_;
65  Unsigned16 ring_port_2_id_;
66  Unsigned16 vlan_id_;
67  Unsigned16 manager_priority_;
68  MRPBoolean check_media_redundancy_;
69  MRPRingState ring_state_;
70  Unsigned16 sequence_id_;
71  Unsigned16 transitions_;
72  Unsigned32 time_stamp_;
73  void * lpvContextInd; /* Ng: add a contexte in this structure. this contexte will be restore on indeication*/
74 };
75 
76 
77 /********************************************/
78 /*** Constructors and destructors ***/
79 /********************************************/
80 
81 void MRP_Domain_T_Init( MRP_Domain_T* const me,
82  MRP_Environment_T* const env_ptr );
83 
84 void MRP_Domain_T_Cleanup( MRP_Domain_T* const me );
85 
86 
87 /********************************************/
88 /*** public Methods ***/
89 /********************************************/
90 
92 MRPError MRP_Domain_T_startMRC( MRP_Domain_T* const me,
93  DomainID domain_id,
94  Unsigned16 ring_port_1_id,
95  Unsigned16 ring_port_2_id,
96  Unsigned16 vlan_id,
97  Unsigned16 link_down_interval,
98  Unsigned16 link_up_interval,
99  Unsigned16 link_change_count,
100  MRPBoolean blocked_state_supported,
101  void * lpvContextInd);
102 
104 MRPError MRP_Domain_T_stop( MRP_Domain_T* const me );
105 
107 MRPError MRP_Domain_T_getRingPort1ID( MRP_Domain_T* const me,
108  Unsigned16* const value );
109 
111 MRPError MRP_Domain_T_getRingPort2ID( MRP_Domain_T* const me,
112  Unsigned16* const value );
113 
115 MRPError MRP_Domain_T_getVLanID( MRP_Domain_T* const me,
116  Unsigned16* const value );
117 
119 MRPError MRP_Domain_T_getRingPort1PortState( MRP_Domain_T* const me,
120  Unsigned16* const value );
121 
123 MRPError MRP_Domain_T_getRingPort2PortState( MRP_Domain_T* const me,
124  Unsigned16* const value );
125 
127 MRPError MRP_Domain_T_getMRCLinkDownInterval( MRP_Domain_T* const me,
128  Unsigned16* const value );
129 
131 MRPError MRP_Domain_T_getMRCLinkUpInterval( MRP_Domain_T* const me,
132  Unsigned16* const value );
133 
135 MRPError MRP_Domain_T_getMRCLinkChangeCount( MRP_Domain_T* const me,
136  Unsigned16* const value );
137 
139 MRPError MRP_Domain_T_getMRCBlockedStateSupported( MRP_Domain_T* const me,
140  MRPBoolean* const value );
141 
143 MRPError MRP_Domain_T_getExpectedRoleState( MRP_Domain_T* const me,
144  Unsigned16* const value );
145 
147 void MRP_Domain_T_getSA_RPort( MRP_Domain_T* const me,
148  Unsigned16 port,
149  UChar sa[6] );
150 
152 void MRP_Domain_T_processPDU( MRP_Domain_T* const me, MRP_PDU_T* pdu );
153 
155 void MRP_Domain_T_runTimers( MRP_Domain_T* const me );
156 
158 void MRP_Domain_T_processLinkChangeInd( MRP_Domain_T* const me,
159  MAUTypeChangeIndData* data_ptr );
160 
162 void MRP_Domain_T_updateRingState( MRP_Domain_T* const me, MRPRingState state);
163 
165 Unsigned16 MRP_Domain_T_getSequenceID( MRP_Domain_T* const me );
166 
167 
168 #endif
169 
170 
Definition: mrp_environment.h:44
Definition: mrp_timer.h:47
Definition: mrp_pduframes.h:40
Definition: mrp_pdu.h:118
DomainID domain_id_
Definition: mrp_domain.h:63
Definition: mrp_protocolmachine.h:61
Definition: mrp_protocolevent.h:54
Definition: mrp_pkg.h:81
Definition: mrp_domain.h:54