Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1592,24 +1592,24 @@ int proxyGetSharedData(
String key = string(readMemory(keyDataPtr, keySize));

// Get shared data value using handler
Handler.SharedData value = handler.getSharedData(key);
SharedData value = handler.getSharedData(key);
if (value == null) {
return WasmResult.NOT_FOUND.getValue();
}

try {
if (value.data.length != 0) {
int addr = malloc(value.data.length);
putMemory(addr, value.data);
if (value.data().length != 0) {
int addr = malloc(value.data().length);
putMemory(addr, value.data());
putUint32(returnValueData, addr);
} else {
putUint32(returnValueData, 0);
}
putUint32(returnValueSize, value.data.length);
putUint32(returnValueSize, value.data().length);
} catch (WasmException e) {
throw new WasmException(WasmResult.INVALID_MEMORY_ACCESS);
}
putUint32(returnCas, value.cas);
putUint32(returnCas, value.cas());
return WasmResult.OK.getValue();

} catch (WasmException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.roastedroot.proxywasm;

public interface ContextHandler {

/**
* Set the effective context ID.
*
* @param contextID The context ID
* @return The result of the operation
*/
default WasmResult setEffectiveContextID(int contextID) {
return WasmResult.UNIMPLEMENTED;
}

/**
* Indicates to the host that the plugin is done processing active context.
*
* @return The result of the operation
*/
default WasmResult done() {
return WasmResult.NOT_FOUND;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.roastedroot.proxywasm;

public interface CustomHandler {

/**
* Get a custom buffer.
*
* @param bufferType The buffer type
* @return The custom buffer as a byte[], or null if not available
*/
default byte[] getCustomBuffer(int bufferType) {
return null;
}

/**
* Set a custom buffer.
*
* @param bufferType The buffer type
* @param buffer The custom buffer as a byte[]
* @return WasmResult indicating success or failure
*/
default WasmResult setCustomBuffer(int bufferType, byte[] buffer) {
return WasmResult.UNIMPLEMENTED;
}

default ProxyMap getCustomHeaders(int mapType) {
return null;
}

/**
* Set a custom header map.
*
* @param mapType The type of map to set
* @param map The header map to set
* @return WasmResult indicating success or failure
*/
default WasmResult setCustomHeaders(int mapType, ProxyMap map) {
return WasmResult.UNIMPLEMENTED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.roastedroot.proxywasm;

public interface FFIHandler {
/**
* Get the function call data.
*
* @return The function call data as a byte[], or null if not available
*/
default byte[] getFuncCallData() {
return null;
}

/**
* Set the function call data.
*
* @param data The function call data as a byte[]
* @return WasmResult indicating success or failure
*/
default WasmResult setFuncCallData(byte[] data) {
return WasmResult.UNIMPLEMENTED;
}

default ForeignFunction getForeignFunction(String name) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package io.roastedroot.proxywasm;

public interface GRPCContextHandler extends StreamContextHandler {

default ProxyMap getGrpcReceiveInitialMetaData() {
return null;
}

default ProxyMap getGrpcReceiveTrailerMetaData() {
return null;
}

/**
* Get the gRPC receive buffer.
*
* @return The gRPC receive buffer as a byte[], or null if not available
*/
default byte[] getGrpcReceiveBuffer() {
return null;
}

/**
* Set the gRPC receive buffer.
*
* @param buffer The gRPC receive buffer as a byte[]
* @return WasmResult indicating success or failure
*/
default WasmResult setGrpcReceiveBuffer(byte[] buffer) {
return WasmResult.UNIMPLEMENTED;
}

default int grpcCall(
String upstreamName,
String serviceName,
String methodName,
ProxyMap initialMetadata,
byte[] message,
int timeout)
throws WasmException {
throw new WasmException(WasmResult.UNIMPLEMENTED);
}

default int grpcStream(
String upstreamName, String serviceName, String methodName, ProxyMap initialMetadata)
throws WasmException {
throw new WasmException(WasmResult.UNIMPLEMENTED);
}

default WasmResult grpcSend(int streamId, byte[] message, int endStream) {
return WasmResult.UNIMPLEMENTED;
}

default WasmResult grpcCancel(int callOrstreamId) {
return WasmResult.UNIMPLEMENTED;
}

default WasmResult grpcClose(int callOrstreamId) {
return WasmResult.UNIMPLEMENTED;
}
}
Loading