require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&EVENT2_RPC_H_INCLUDED_)) {
    eval 'sub EVENT2_RPC_H_INCLUDED_ () {1;}' unless defined(&EVENT2_RPC_H_INCLUDED_);
    require 'event2/util.ph';
    require 'event2/visibility.ph';
    if(defined(&__cplusplus)) {
    }
    eval 'sub EVTAG_HAS {
        my($msg, $member) = @_;
	    eval q((($msg)->$member &_set == 1));
    }' unless defined(&EVTAG_HAS);
    unless(defined(&EVENT2_RPC_COMPAT_H_INCLUDED_)) {
	eval 'sub EVTAG_ASSIGN {
	    my($msg, $member, $value) = @_;
    	    eval q((*($msg)-> ($base->{member}) &_assign)(($msg), ($value)));
	}' unless defined(&EVTAG_ASSIGN);
	eval 'sub EVTAG_ASSIGN_WITH_LEN {
	    my($msg, $member, $value, $len) = @_;
    	    eval q((*($msg)-> ($base->{member}) &_assign)(($msg), ($value), ($len)));
	}' unless defined(&EVTAG_ASSIGN_WITH_LEN);
	eval 'sub EVTAG_GET {
	    my($msg, $member, $pvalue) = @_;
    	    eval q((*($msg)-> ($base->{member}) &_get)(($msg), ($pvalue)));
	}' unless defined(&EVTAG_GET);
	eval 'sub EVTAG_GET_WITH_LEN {
	    my($msg, $member, $pvalue, $plen) = @_;
    	    eval q((*($msg)-> ($base->{member}) &_get)(($msg), ($pvalue), ($plen)));
	}' unless defined(&EVTAG_GET_WITH_LEN);
    }
    eval 'sub EVTAG_ARRAY_ADD_VALUE {
        my($msg, $member, $value) = @_;
	    eval q((*($msg)-> ($base->{member}) &_add)(($msg), ($value)));
    }' unless defined(&EVTAG_ARRAY_ADD_VALUE);
    eval 'sub EVTAG_ARRAY_ADD {
        my($msg, $member) = @_;
	    eval q((*($msg)-> ($base->{member}) &_add)($msg));
    }' unless defined(&EVTAG_ARRAY_ADD);
    eval 'sub EVTAG_ARRAY_GET {
        my($msg, $member, $offset, $pvalue) = @_;
	    eval q((*($msg)-> ($base->{member}) &_get)(($msg), ($offset), ($pvalue)));
    }' unless defined(&EVTAG_ARRAY_GET);
    eval 'sub EVTAG_ARRAY_LEN {
        my($msg, $member) = @_;
	    eval q((($msg)->$member &_length));
    }' unless defined(&EVTAG_ARRAY_LEN);
    eval 'sub EVRPC_STRUCT {
        my($rpcname) = @_;
	    eval q(\'struct evrpc_req__\'$rpcname);
    }' unless defined(&EVRPC_STRUCT);
    eval 'sub EVRPC_HEADER {
        my($rpcname, $reqstruct, $rplystruct) = @_;
	    eval q( &EVRPC_STRUCT($rpcname) { \'struct evrpc_hook_meta\' * &hook_meta; \'struct reqstruct\'*  &request; \'struct rplystruct\'*  &reply; \'struct evrpc\'*  &rpc; \'struct evhttp_request\'*  &http_req; \'struct evbuffer\'*  &rpc_data; };  &EVENT2_EXPORT_SYMBOL \'int\'  &evrpc_send_request_$rpcname(\'struct evrpc_pool\' *, \'struct reqstruct\' *, \'struct rplystruct\' *,  &void (*)(\'struct evrpc_status\' *, \'struct reqstruct\' *, \'struct rplystruct\' *,  &void * &cbarg),  &void *););
    }' unless defined(&EVRPC_HEADER);
    eval 'sub EVRPC_MAKE_CTX {
        my($rpcname, $reqstruct, $rplystruct,     $pool, $request, $reply, $cb, $cbarg) = @_;
	    eval q( &evrpc_make_request_ctx($pool, $request, $reply, $rpcname, ( &void (*)(\'struct evbuffer\' *,  &void *))$reqstruct &_marshal, ( &void (*)( &void *))$rplystruct &_clear, ( &int (*)( &void *, \'struct evbuffer\' *))$rplystruct &_unmarshal, ( &void (*)(\'struct evrpc_status\' *,  &void *,  &void *,  &void *))$cb, $cbarg));
    }' unless defined(&EVRPC_MAKE_CTX);
    eval 'sub EVRPC_GENERATE {
        my($rpcname, $reqstruct, $rplystruct) = @_;
	    eval q(\'int\'  &evrpc_send_request_$rpcname(\'struct evrpc_pool\' * &pool, \'struct reqstruct\' * &request, \'struct rplystruct\' * &reply,  &void (* &cb)(\'struct evrpc_status\' *, \'struct reqstruct\' *, \'struct rplystruct\' *,  &void * &cbarg),  &void * &cbarg) {  &return  &evrpc_send_request_generic( &pool,  &request,  &reply, ( &void (*)(\'struct evrpc_status\' *,  &void *,  &void *,  &void *)) &cb,  &cbarg, $rpcname, ( &void (*)(\'struct evbuffer\' *,  &void *))$reqstruct &_marshal, ( &void (*)( &void *))$rplystruct &_clear, ( &int (*)( &void *, \'struct evbuffer\' *))$rplystruct &_unmarshal); });
    }' unless defined(&EVRPC_GENERATE);
    eval 'sub EVRPC_REQUEST_HTTP {
        my($rpc_req) = @_;
	    eval q(($rpc_req)-> &http_req);
    }' unless defined(&EVRPC_REQUEST_HTTP);
    eval 'sub EVRPC_REQUEST_DONE {
        my($rpc_req) = @_;
	    eval q( &do { \'struct evrpc_req_generic\' * &req_ = ($rpc_req);  &evrpc_request_done( &req_); }  &while (0));
    }' unless defined(&EVRPC_REQUEST_DONE);
    eval 'sub EVRPC_REGISTER {
        my($base, $name, $request, $reply, $callback, $cbarg) = @_;
	    eval q( &evrpc_register_generic($base, $name, ( &void (*)(\'struct evrpc_req_generic\' *,  &void *))$callback, $cbarg, ( &void *(*)( &void *))$request &_new_with_arg,  &NULL, ( &void (*)( &void *))$request &_free, ( &int (*)( &void *, \'struct evbuffer\' *))$request &_unmarshal, ( &void *(*)( &void *))$reply &_new_with_arg,  &NULL, ( &void (*)( &void *))$reply &_free, ( &int (*)( &void *))$reply &_complete, ( &void (*)(\'struct evbuffer\' *,  &void *))$reply &_marshal));
    }' unless defined(&EVRPC_REGISTER);
    eval 'sub EVRPC_UNREGISTER {
        my($base, $name) = @_;
	    eval q( &evrpc_unregister_rpc(($base), $name));
    }' unless defined(&EVRPC_UNREGISTER);
    eval 'sub EVRPC_MAKE_REQUEST {
        my($name, $pool, $request, $reply, $cb, $cbarg) = @_;
	    eval q( &evrpc_send_request_$name(($pool), ($request), ($reply), ($cb), ($cbarg)));
    }' unless defined(&EVRPC_MAKE_REQUEST);
    eval("sub EVRPC_INPUT () { 0; }") unless defined(&EVRPC_INPUT);
    eval("sub EVRPC_OUTPUT () { 1; }") unless defined(&EVRPC_OUTPUT);
    unless(defined(&_WIN32)) {
	eval 'sub INPUT () { &EVRPC_INPUT;}' unless defined(&INPUT);
	eval 'sub OUTPUT () { &EVRPC_OUTPUT;}' unless defined(&OUTPUT);
    }
    eval("sub EVRPC_TERMINATE () { -1; }") unless defined(&EVRPC_TERMINATE);
    eval("sub EVRPC_CONTINUE () { 0; }") unless defined(&EVRPC_CONTINUE);
    eval("sub EVRPC_PAUSE () { 1; }") unless defined(&EVRPC_PAUSE);
    if(defined(&__cplusplus)) {
    }
}
1;
