Skip to content

Commit 772c557

Browse files
authored
export pair marshalling (#60)
1 parent 0a1fcd4 commit 772c557

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/proxy-wasm/exports.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ extern thread_local ContextBase *current_context_;
2727

2828
namespace exports {
2929

30+
template <typename Pairs> size_t pairsSize(const Pairs &result);
31+
template <typename Pairs> void marshalPairs(const Pairs &result, char *buffer);
32+
template <typename Pairs>
33+
bool getPairs(ContextBase *context, const Pairs &result, uint64_t ptr_ptr, uint64_t size_ptr);
34+
3035
// ABI functions exported from envoy to wasm.
3136

3237
Word get_configuration(void *raw_context, Word address, Word size);

src/exports.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Pairs toPairs(std::string_view buffer) {
6767
return result;
6868
}
6969

70+
} // namespace
71+
7072
template <typename Pairs> size_t pairsSize(const Pairs &result) {
7173
size_t size = 4; // number of headers
7274
for (auto &p : result) {
@@ -115,8 +117,6 @@ bool getPairs(ContextBase *context, const Pairs &result, uint64_t ptr_ptr, uint6
115117
return true;
116118
}
117119

118-
} // namespace
119-
120120
// General ABI.
121121

122122
Word set_property(void *raw_context, Word key_ptr, Word key_size, Word value_ptr, Word value_size) {

0 commit comments

Comments
 (0)