public interface ExtendedClosure extends Closure {
public RequestInfo reqInfo;
public InputStream payload;
}
このインタフェースはClosureから派生したインタフェースであり,読み取り専用属性に使用するRequestInfoを格納します。
struct RequestInfo {
boolean response_expected;
unsigned long request_id;
};
ServerRequestInterceptorおよびClientRequestInterceptorに渡されたClosureオブジェクトを,サブクラスExtendedClosureにキャストできます。ExtendedClosureを使用して,RequestInfoを抽出し,さらにそのRequestInfoからrequest_idとresponse_expectedを抽出できます。request_idは,リクエストに割り当てられた一意の識別子です。response_expectedフラグは,リクエストが一方向呼び出しであるかどうかを識別します。
int my_response_expected =
((ExtendedClosure)closure).reqInfo.response_expected;
int my_request_id = ((ExtendedClosure)closure).reqInfo.request_id;
詳細については,examples/interceptor/client_serverにある例を参照してください。