blob: c380322b296d61fa3bd04f7c24103212d79464e8 [file] [log] [blame]
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -07003 *
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.onosproject.openflow.controller;
17
18import java.util.Collections;
19
20import org.projectfloodlight.openflow.protocol.OFMessage;
21
22/**
23 * Represents to OpenFlow session.
24 */
25public interface OpenFlowSession {
26
27 /**
28 * Returns session state.
29 *
30 * @return true if active.
31 */
32 boolean isActive();
33
34 /**
35 * Requests to close this OpenFlow session.
36 */
37 void closeSession();
38
39 /**
40 * Sends messages over this session.
41 * @param msgs to send
42 * @return true is messages were sent
43 */
44 boolean sendMsg(Iterable<OFMessage> msgs);
45
46 /**
47 * Sends message over this session.
48 *
49 * @param msg to send
50 * @return true is messages were sent
51 */
52 default boolean sendMsg(OFMessage msg) {
53 return sendMsg(Collections.singletonList(msg));
54 }
55
56 /**
57 * Returns debug information about this session.
58 *
59 * @return debug information
60 */
61 CharSequence sessionInfo();
62
63
64}