Example #1
0
def hookdemo_config(dataprov, cmd, param, val):
    Z_TRACE_F("dataprov: " + str(dataprov) + ", cmd: '" + cmd + "', param: '" +
              param + "', val: '" + val + "'")
    if cmd == "put":
        ret = True
        res = None
    elif cmd == "get":
        ret = True
        res = param
    else:
        ret = False
        res = "configuration failed"
    Z_TRACE_F("return: " + str(ret) + ", result: " + str(res))
    return (ret, res) if res != None else ret
Example #2
0
def sighandler(sig, frame):
    Z_TRACE_F("sig: " + str(sig))

    interrupt = (sig != 0)

    if NODEPORT_TCP != None:
        scdc.nodeport_cancel(np_tcp, interrupt)
    if NODEPORT_STREAM != None:
        scdc.nodeport_cancel(np_stream, interrupt)
Example #3
0
def cmd_handler(data, cmd, params):
    Z_TRACE_F("data: " + str(data) + ", cmd: '" + cmd + "', params: '" +
              params + "'")

    if cmd == "quit":
        Z_TRACE("quiting server")
        sighandler(0, None)
    else:
        Z_TRACE("unkown server command: '" + cmd + "'")

    return True
Example #4
0
def hookdemo_dataset_cmd(dataprov, dataset, cmd, params, input, output):
    Z_TRACE_F("dataset_cmd:")
    Z_TRACE_F(" dataprov: '" + str(dataprov) + "'")
    Z_TRACE_F(" dataset: '" + str(dataset) + "'")
    Z_TRACE_F(" cmd: '" + cmd + "'")
    Z_TRACE_F(" params: '" + str(params) + "'")
    Z_TRACE_F(" input: " + str(input))
    Z_TRACE_F(" output: " + str(output))

    output.buf = "OUT"
    output.buf_size = len(output.buf)
    output.current_size = output.buf_size
    output.total_size = output.current_size

    ret = True
    res = "result of " + __func__()

    Z_TRACE_F(" return: " + str((ret, res)))
    return (ret, res)
Example #5
0
def hookdemo_dataset_open_read_state(dataprov, state):
    Z_TRACE_F("dataprov: " + str(dataprov) + ", state: '" + state + "'")
    ds = int(state)
    res = "result of " + __func__()
    Z_TRACE_F("return: dataset: " + str(ds) + ", result: " + res)
    return (ds, res)
Example #6
0
def hookdemo_dataset_close_write_state(dataprov, dataset):
    Z_TRACE_F("dataprov: " + str(dataprov) + ", dataset: " + str(dataset))
    ret = str(dataset)
    res = "result of " + __func__()
    Z_TRACE_F("return: " + str(ret) + ", result: " + res)
    return (ret, res)
Example #7
0
def hookdemo_dataset_open(dataprov, path):
    Z_TRACE_F("dataprov: " + str(dataprov) + ", path: '" + path + "'")
    ds = dataprov + 1
    res = "result of " + __func__()
    Z_TRACE_F("return: dataset: " + str(ds) + ", result: " + res)
    return (ds, res)
Example #8
0
def hookdemo_close(dataprov):
    Z_TRACE_F("dataprov: " + str(dataprov))
    ret = True
    Z_TRACE_F("return: " + str(ret))
    return ret
Example #9
0
def hookdemo_open(conf, *args):
    Z_TRACE_F("conf: '" + str(conf) + "', args: '" + str(args) + "'")
    dp = 0xDEADBEEF
    Z_TRACE_F("return: dataprov: " + str(dp))
    return dp