aboutsummaryrefslogtreecommitdiffstats
path: root/metis/ccnx/forwarder/metis/io/metis_EtherConnection.h
blob: c92587f1ea0d8d665798cb8d13b9a9593e081844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file metis_EtherConnection.h
 * @brief Represents an ethernet pair (source address, destination address) in the connection table
 *
 * Ethernet connections are never local.
 *
 */

#ifndef Metis_metis_EtherConnection_h
#define Metis_metis_EtherConnection_h

#include <ccnx/forwarder/metis/io/metis_IoOperations.h>
#include <ccnx/forwarder/metis/core/metis_Forwarder.h>
#include <ccnx/forwarder/metis/io/metis_AddressPair.h>
#include <ccnx/api/control/cpi_Address.h>
#include <ccnx/forwarder/metis/io/metis_GenericEther.h>
#include <ccnx/forwarder/metis/io/metis_HopByHopFragmenter.h>
#include <ccnx/forwarder/metis/core/metis_Connection.h>

/**
 * @function metisEtherConnection_Create
 * @abstract <#OneLineDescription#>
 * @discussion
 *   <#Discussion#>
 *
 * @param pair the address pair that uniquely identifies the connection.  Takes ownership of this memory.
 * @return <#return#>
 */
MetisIoOperations *metisEtherConnection_Create(MetisForwarder *metis, MetisGenericEther *ether, MetisAddressPair *pair);

/**
 * If the IO Operats are of type MetisEtherConnection, return its fragmenter
 *
 * <#Paragraphs Of Explanation#>
 *
 * @param [in] conn An allocated MetisConnection
 *
 * @return non-null The fragmenter associated with this conneciton
 * @return null There is no such fragmenter or the ops is not a MetisEtherConnection
 *
 * Example:
 * @code
 * {
 *     <#example#>
 * }
 * @endcode
 */
MetisHopByHopFragmenter *metisEtherConnection_GetFragmenter(const MetisConnection *conn);

/**
 * Tests if MetisEtherConnection is the underlying implementation of the connection
 *
 * <#Paragraphs Of Explanation#>
 *
 * @param [in] conn An allocated MetisConnection
 *
 * @return true The connection is of type MetisEtherConnection
 * @return false The connection is of other type
 *
 * Example:
 * @code
 * {
 *    MetisHopByHopFragmenter *
 *    metisEtherConnection_GetFragmenter(const MetisConnection *conn)
 *    {
 *        MetisHopByHopFragmenter *fragmenter = NULL;
 *
 *        if (metisEtherConnection_IsInstanceOf(conn)) {
 *            MetisIoOperations *ops = metisConnection_GetIoOperations(conn);
 *            _MetisEtherState *state = (_MetisEtherState *) ops->context;
 *            fragmenter = state->fragmenter;
 *        }
 *        return fragmenter;
 *    }
 * }
 * @endcode
 */
bool metisEtherConnection_IsInstanceOf(const MetisConnection *conn);

#endif // Metis_metis_EtherConnection_h