Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.openflow.controller; |
| 17 | |
| 18 | import java.util.Collections; |
| 19 | |
| 20 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 21 | |
| 22 | /** |
| 23 | * Represents to OpenFlow session. |
| 24 | */ |
| 25 | public 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 | |
Anton Chigrin | 4af4f87 | 2019-01-14 17:29:56 +0200 | [diff] [blame^] | 63 | /** |
| 64 | * Add classifier to runtime store of classifiers. |
| 65 | * |
| 66 | * @param classifier the OpenFlow classifier to add |
| 67 | */ |
| 68 | void addClassifier(OpenFlowClassifier classifier); |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 69 | |
Anton Chigrin | 4af4f87 | 2019-01-14 17:29:56 +0200 | [diff] [blame^] | 70 | /** |
| 71 | * Remove classifier from runtime store of classifiers. |
| 72 | * |
| 73 | * @param classifier the OpenFlow classifier to remove |
| 74 | */ |
| 75 | void removeClassifier(OpenFlowClassifier classifier); |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 76 | } |