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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
/*
* 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.
*/
#ifndef ICNET_CONSUMER_SOCKET_H_
#define ICNET_CONSUMER_SOCKET_H_
#include "icnet_common.h"
#include "icnet_socket.h"
#include "icnet_transport.h"
#include "icnet_transport_raaqm.h"
#include "icnet_transport_vegas.h"
#define CONSUMER_READY 0
#define CONSUMER_BUSY 1
namespace icnet {
class ConsumerSocket : public Socket {
public:
explicit ConsumerSocket(const Name prefix, int protocol);
~ConsumerSocket();
int consume(Name suffix);
int asyncConsume(Name suffix);
void stop();
int setSocketOption(int socket_option_key, int socket_option_value);
int setSocketOption(int socket_option_key, double socket_option_value);
int setSocketOption(int socket_option_key, bool socket_option_value);
int setSocketOption(int socket_option_key, size_t socket_option_value);
int setSocketOption(int socket_option_key, Name socket_option_value);
int setSocketOption(int socket_option_key, ProducerContentObjectCallback socket_option_value);
int setSocketOption(int socket_option_key, ConsumerContentObjectVerificationCallback socket_option_value);
int setSocketOption(int socket_option_key, ConsumerContentObjectCallback socket_option_value);
int setSocketOption(int socket_option_key, ConsumerInterestCallback socket_option_value);
int setSocketOption(int socket_option_key, ProducerInterestCallback socket_option_value);
int setSocketOption(int socket_option_key, ConsumerContentCallback socket_option_value);
int setSocketOption(int socket_option_key, ConsumerManifestCallback socket_option_value);
int setSocketOption(int socket_option_key, KeyLocator socket_option_value);
int setSocketOption(int socket_option_key, IcnObserver *socket_option_value);
int getSocketOption(int socket_option_key, int &socket_option_value);
int getSocketOption(int socket_option_key, double &socket_option_value);
int getSocketOption(int socket_option_key, size_t &socket_option_value);
int getSocketOption(int socket_option_key, bool &socket_option_value);
int getSocketOption(int socket_option_key, Name &socket_option_value);
int getSocketOption(int socket_option_key, ProducerContentObjectCallback &socket_option_value);
int getSocketOption(int socket_option_key, ConsumerContentObjectVerificationCallback &socket_option_value);
int getSocketOption(int socket_option_key, ConsumerContentObjectCallback &socket_option_value);
int getSocketOption(int socket_option_key, ConsumerInterestCallback &socket_option_value);
int getSocketOption(int socket_option_key, ProducerInterestCallback &socket_option_value);
int getSocketOption(int socket_option_key, ConsumerContentCallback &socket_option_value);
int getSocketOption(int socket_option_key, ConsumerManifestCallback &socket_option_value);
int getSocketOption(int socket_option_key, KeyLocator &socket_option_value);
int getSocketOption(int socket_option_key, std::shared_ptr<Portal> &socket_option_value);
int getSocketOption(int socket_option_key, IcnObserver **socket_option_value);
private:
void postponedConsume(Name name_suffix);
private:
// context inner state variables
bool is_running_;
std::shared_ptr<Portal> portal_;
std::shared_ptr<TransportProtocol> transport_protocol_;
Name name_prefix_;
Name name_suffix_;
int interest_lifetime_;
double min_window_size_;
double max_window_size_;
double current_window_size_;
int max_retransmissions_;
size_t output_buffer_size_;
size_t input_buffer_size_;
// RAAQM Parameters
double minimum_drop_probability_;
unsigned int sample_number_;
double gamma_;
double beta_;
double drop_factor_;
//Rate estimation parameters
double rate_estimation_alpha_;
IcnObserver *rate_estimation_observer_;
int rate_estimation_batching_parameter_;
int rate_estimation_choice_;
bool is_async_;
KeyLocator key_locator_;
ConsumerInterestCallback on_interest_retransmission_;
ConsumerInterestCallback on_interest_output_;
ConsumerInterestCallback on_interest_timeout_;
ConsumerInterestCallback on_interest_satisfied_;
ConsumerContentObjectCallback on_content_object_input_;
ConsumerContentObjectVerificationCallback on_content_object_verification_;
ConsumerContentObjectCallback on_content_object_;
ConsumerManifestCallback on_manifest_;
ConsumerContentCallback on_payload_retrieved_;
// Virtual download for traffic generator
bool virtual_download_;
bool rtt_stats_;
};
} // end namespace icnet
#endif // ICNET_CONSUMER_SOCKET_H_
|