forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ABI functions return WasmResult. (envoyproxy#133)
* ABI functions return WasmResult. Signed-off-by: John Plevyak <[email protected]>
- Loading branch information
Showing
66 changed files
with
15,430 additions
and
14,954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
386 changes: 209 additions & 177 deletions
386
api/wasm/cpp/proxy_wasm_impl.h → api/wasm/cpp/proxy_wasm_api.h
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Intrinsic enumerations available to WASM modules. | ||
*/ | ||
// NOLINT(namespace-envoy) | ||
|
||
#pragma once | ||
|
||
enum class MetadataType : int32_t { | ||
Request = 0, | ||
Response = 1, | ||
RequestRoute = 2, // Immutable | ||
ResponseRoute = 3, // Immutable | ||
Log = 4, // Immutable | ||
Node = 5, // Immutable | ||
Listener = 6, // Immutable | ||
Cluster = 7, // Immutable | ||
Expression = 8, // The key is a string expression. Only proxy_getMetadata(). | ||
MAX = 8, | ||
}; | ||
/* | ||
Expression and their types: | ||
request.protocol : string | ||
response.protocol : string | ||
request.destination_port : int32 | ||
response.destination_port : int32 | ||
request.response_code : int32 | ||
response.response_code : int32 | ||
upstream.tls_version : string | ||
downstream.tls_version : string | ||
plugin.direction : int32 (enum PluginDirection) | ||
*/ | ||
|
||
enum class HeaderMapType : int32_t { | ||
RequestHeaders = 0, // During the onLog callback these are immutable | ||
RequestTrailers = 1, // During the onLog callback these are immutable | ||
ResponseHeaders = 2, // During the onLog callback these are immutable | ||
ResponseTrailers = 3, // During the onLog callback these are immutable | ||
GrpcCreateInitialMetadata = 4, | ||
GrpcReceiveInitialMetadata = 5, // Immutable | ||
GrpcReceiveTrailingMetadata = 6, // Immutable | ||
MAX = 6, | ||
}; | ||
|
||
enum class PluginDirection : int32_t { | ||
Unspecified = 0, | ||
Inbound = 1, | ||
Outbound = 2, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Intrinsic enumerations available to WASM modules. | ||
*/ | ||
// NOLINT(namespace-envoy) | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
enum class WasmResult : uint32_t { | ||
Ok = 0, | ||
// The result could not be found, e.g. a provided key did not appear in a table. | ||
NotFound = 1, | ||
// An argument was bad, e.g. did not not conform to the required range. | ||
BadArgument = 2, | ||
// A protobuf could not be serialized. | ||
SerializationFailure = 3, | ||
// A protobuf could not be parsed. | ||
ParseFailure = 4, | ||
// A provided expression (e.g. "foo.bar") was illegal or unrecognized. | ||
BadExpression = 5, | ||
// A provided memory range was not legal. | ||
InvalidMemoryAccess = 6, | ||
// Data was requested from an empty container. | ||
Empty = 7, | ||
// The provided CAS did not match that of the stored data. | ||
CasMismatch = 8, | ||
}; | ||
|
||
inline std::string toString(WasmResult r) { | ||
switch (r) { | ||
case WasmResult::Ok: return "Ok"; | ||
case WasmResult::NotFound : return "NotFound"; | ||
case WasmResult::BadArgument : return "BadArgument"; | ||
case WasmResult::SerializationFailure : return "SerializationFailure"; | ||
case WasmResult::ParseFailure : return "ParseFailure"; | ||
case WasmResult::BadExpression : return "BadExpression"; | ||
case WasmResult::InvalidMemoryAccess : return "InvalidMemoryAccess"; | ||
case WasmResult::Empty : return "Empty"; | ||
case WasmResult::CasMismatch : return "CasMismatch"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.