blob: ae799316e78b405a837d7e48c0ef1c3abe686ee6 [file] [log] [blame]
Ilayda Ozdemir4c5947c2020-05-05 13:14:32 +00001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.opencord.igmpproxy.statemachine;
17
18import org.onlab.packet.Ip4Address;
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.PortNumber;
21
22/**
23 * State machine object.
24 */
25public interface StateMachine {
26 /**
27 * Returns identification of state-machine.
28 *
29 * @return identification
30 */
31 StateMachineId getStateMachineId();
32
33 /**
34 * Returns group ip of state-machine.
35 *
36 * @return ip of group
37 */
38 Ip4Address getGroupIp();
39
40 /**
41 * Returns device id of state-machine.
42 *
43 * @return device id
44 */
45 DeviceId getDeviceId();
46
47 /**
48 * Returns source ip of state-machine.
49 *
50 * @return source ip
51 */
52 Ip4Address getSrcIp();
53
54 /**
55 * Returns up-link port of state-machine.
56 *
57 * @return up-link port
58 */
59 PortNumber getUpLinkPort();
60
61 /**
62 * Returns timeout. it is nullable.
63 *
64 * @return timeout
65 */
66 Integer getTimeOut();
67
68 /**
69 * Set timer to max timeout.
70 */
71 void setMaxTimeout();
72
73 /**
74 * Start timer.
75 *
76 * @param timeout timeout
77 */
78 void startTimer(int timeout);
79
80 /**
81 * Resets timer.
82 *
83 * @param timeout timeout of timer
84 */
85 void resetTimer(int timeout);
86
87 /**
88 * Destroy timeout.
89 */
90 void destroyTimer();
91
92 /**
93 * Increases timeout of timer.
94 */
95 void increaseTimeOut();
96
97 /**
98 * Decreases timeout of timer.
99 */
100 void decreaseTimeOut();
101
102 /**
103 * Returns current state.
104 *
105 * @return current state
106 */
107 int currentState();
108
109 /**
110 * Makes the requirements of join request and transition to next station.
111 *
112 * @param messageOutAllowed message out allowed
113 */
114 void join(boolean messageOutAllowed);
115
116 /**
117 * Makes the requirements of leave request and transition to next station.
118 *
119 * @param messageOutAllowed message out allowed
120 */
121 void leave(boolean messageOutAllowed);
122
123 /**
124 * Makes the requirements of query request and transition to next station.
125 *
126 * @param maxResp maximum resp
127 */
128 void query(int maxResp);
129
130 /**
131 * Makes the requirements of timeout request and transition to next station.
132 *
133 * @param sendQuery send query for test
134 */
135 void timeOut(boolean sendQuery);
136}