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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/*
* Copyright (c) 2017-2019 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.
*/
#pragma once
#include <functional>
#include <system_error>
#include <hicn/transport/core/facade.h>
namespace utils {
class MemBuf;
}
namespace transport {
namespace protocol {
class IcnObserver;
class TransportStatistics;
} // namespace protocol
namespace core {
class ContentObject;
class Interest;
} // namespace core
namespace interface {
// Forward declarations
class ConsumerSocket;
class ProducerSocket;
/**
* The ConsumerInterestCallback will be called in different parts of the
* consumer socket processing pipeline, with a ConsumerSocket and an Interest as
* parameters.
*/
using ConsumerInterestCallback =
std::function<void(ConsumerSocket &, const core::Interest &)>;
/**
* The ConsumerTimerCallback is called periodically for exposing to applications
* a summary of the statistics of the transport protocol in use.
*/
using ConsumerTimerCallback = std::function<void(
ConsumerSocket &, const protocol::TransportStatistics &stats)>;
/**
* The ProducerContentCallback will be called by the producer socket right after
* a content has been segmented and published.
*/
using ProducerContentCallback = std::function<void(
ProducerSocket &, const std::error_code &, uint64_t bytes_written)>;
/**
* The ConsumerContentObjectCallback will be called in different parts of the
* consumer socket processing pipeline, with a ConsumerSocket and an
* ContentObject as parameters.
*/
using ConsumerContentObjectCallback =
std::function<void(ConsumerSocket &, const core::ContentObject &)>;
/**
* The ConsumerContentObjectVerificationCallback will be called by the transport
* if an application is willing to verify each content object. Note that a
* better alternative is to instrument the transport to perform the verification
* autonomously, without requiring the intervention of the application.
*/
using ConsumerContentObjectVerificationCallback =
std::function<bool(ConsumerSocket &, const core::ContentObject &)>;
/**
* The ConsumerManifestCallback will be called by the consumer socket when a
* manifest is received.
*/
using ConsumerManifestCallback =
std::function<void(ConsumerSocket &, const core::ContentObjectManifest &)>;
/**
* The ProducerContentObjectCallback will be called in different parts of the
* consumer socket processing pipeline, with a ProducerSocket and an
* ContentObject as parameters.
*/
using ProducerContentObjectCallback =
std::function<void(ProducerSocket &, core::ContentObject &)>;
/**
* The ProducerContentObjectCallback will be called in different parts of the
* consumer socket processing pipeline, with a ProducerSocket and an
* Interest as parameters.
*/
using ProducerInterestCallback =
std::function<void(ProducerSocket &, core::Interest &)>;
extern std::nullptr_t VOID_HANDLER;
} // namespace interface
} // namespace transport
|