def async_rpc_open(event_ctx, server, cred, binding, arg, callback): # create a composite context for this sequence of asynchronous calls c = composite_create(None, event_ctx) c.contents.async.fn = callback c.contents.async.private_data = None # build a binding string using the only protocol we care about... binding = library.talloc_strdup(c, "%s:%s" % (binding, server)) # create a set of credentials creds = library.cli_credentials_init(c) if library.composite_nomem(creds, c): return c library.cli_credentials_set_conf(creds); if cred: library.cli_credentials_parse_string(creds, cred, CRED_SPECIFIED); # issue the asynchronous rpc pipe connect request rpc_ctx = library.dcerpc_pipe_connect_send(c, binding, arg, creds, event_ctx) if library.composite_nomem(rpc_ctx, c): return c # setup the next stage of the connect process library.composite_continue(c, rpc_ctx, rpc_connect_continue, c) return c
def async_rpc_open(event_ctx, server, cred, binding, arg, callback): # create a composite context for this sequence of asynchronous calls c = composite_create(None, event_ctx) c.contents. async .fn = callback c.contents. async .private_data = None # build a binding string using the only protocol we care about... binding = library.talloc_strdup(c, "%s:%s" % (binding, server)) # create a set of credentials creds = library.cli_credentials_init(c) if library.composite_nomem(creds, c): return c library.cli_credentials_set_conf(creds) if cred: library.cli_credentials_parse_string(creds, cred, CRED_SPECIFIED) # issue the asynchronous rpc pipe connect request rpc_ctx = library.dcerpc_pipe_connect_send(c, binding, arg, creds, event_ctx) if library.composite_nomem(rpc_ctx, c): return c # setup the next stage of the connect process library.composite_continue(c, rpc_ctx, rpc_connect_continue, c) return c
def call(self, send_func, arg, ctx = None): cb = Callback() if ctx is None: ctx = self.ctx ctx.contents.async.fn = cb.callback ctx.contents.async.private_data = None rpc_ctx = cast(send_func(self.rpc_pipe, ctx, arg), POINTER(rpc_request)) if library.composite_nomem(rpc_ctx, ctx): return library.composite_continue_rpc(ctx, rpc_ctx, continue_rpc, ctx); return cb.deferred
def call(self, send_func, arg, ctx=None): cb = Callback() if ctx is None: ctx = self.ctx ctx.contents. async .fn = cb.callback ctx.contents. async .private_data = None rpc_ctx = send_func(self.rpc_pipe, ctx, arg) if library.composite_nomem(rpc_ctx, ctx): return library.composite_continue_rpc(ctx, rpc_ctx, continue_rpc, ctx) return cb.deferred