18 #include <hicn/transport/auth/signer.h>
19 #include <hicn/transport/config.h>
20 #include <hicn/transport/core/asio_wrapper.h>
21 #include <hicn/transport/core/name.h>
22 #include <hicn/transport/core/prefix.h>
23 #include <hicn/transport/interfaces/callbacks.h>
24 #include <hicn/transport/interfaces/socket_options_default_values.h>
25 #include <hicn/transport/interfaces/socket_options_keys.h>
29 namespace implementation {
40 int protocol = ProductionProtocolAlgorithms::BYTE_STREAM);
42 explicit ProducerSocket(
int protocol, asio::io_service &io_service);
50 void registerPrefix(
const Prefix &producer_namespace);
52 uint32_t produceStream(
const Name &content_name,
const uint8_t *buffer,
53 size_t buffer_size,
bool is_last =
true,
54 uint32_t start_offset = 0);
56 uint32_t produceStream(
const Name &content_name,
57 std::unique_ptr<utils::MemBuf> &&buffer,
58 bool is_last =
true, uint32_t start_offset = 0);
60 uint32_t produceDatagram(
const Name &content_name,
const uint8_t *buffer,
63 uint32_t produceDatagram(
const Name &content_name,
64 std::unique_ptr<utils::MemBuf> &&buffer);
66 void asyncProduce(
const Name &suffix,
const uint8_t *buf,
size_t buffer_size,
67 bool is_last =
true, uint32_t *start_offset =
nullptr);
69 void asyncProduce(
Name content_name, std::unique_ptr<utils::MemBuf> &&buffer,
70 bool is_last, uint32_t offset,
71 uint32_t **last_segment =
nullptr);
79 asio::io_service &getIoService();
81 int setSocketOption(
int socket_option_key, uint32_t socket_option_value);
83 int setSocketOption(
int socket_option_key,
84 std::nullptr_t socket_option_value);
86 int setSocketOption(
int socket_option_key,
bool socket_option_value);
88 int setSocketOption(
int socket_option_key,
Name *socket_option_value);
90 int setSocketOption(
int socket_option_key,
91 std::list<Prefix> socket_option_value);
93 int setSocketOption(
int socket_option_key,
94 ProducerContentObjectCallback socket_option_value);
96 int setSocketOption(
int socket_option_key,
97 ProducerInterestCallback socket_option_value);
99 int setSocketOption(
int socket_option_key,
100 ProducerContentCallback socket_option_value);
102 int setSocketOption(
int socket_option_key,
103 auth::CryptoHashType socket_option_value);
105 int setSocketOption(
int socket_option_key,
106 auth::CryptoSuite socket_option_value);
108 int setSocketOption(
int socket_option_key,
109 const std::shared_ptr<auth::Signer> &socket_option_value);
111 int setSocketOption(
int socket_option_key,
112 const std::string &socket_option_value);
114 int getSocketOption(
int socket_option_key, uint32_t &socket_option_value);
116 int getSocketOption(
int socket_option_key,
bool &socket_option_value);
118 int getSocketOption(
int socket_option_key,
119 std::list<Prefix> &socket_option_value);
121 int getSocketOption(
int socket_option_key,
122 ProducerContentObjectCallback **socket_option_value);
124 int getSocketOption(
int socket_option_key,
125 ProducerContentCallback **socket_option_value);
127 int getSocketOption(
int socket_option_key,
128 ProducerInterestCallback **socket_option_value);
130 int getSocketOption(
int socket_option_key,
131 auth::CryptoHashType &socket_option_value);
133 int getSocketOption(
int socket_option_key,
134 auth::CryptoSuite &socket_option_value);
136 int getSocketOption(
int socket_option_key,
137 std::shared_ptr<auth::Signer> &socket_option_value);
139 int getSocketOption(
int socket_option_key, std::string &socket_option_value);
143 std::unique_ptr<implementation::ProducerSocket> socket_;