Exemplo n.º 1
0
def app_init (_tbc):
    # acquire a reference to the turbulence context
    global tbc;
    tbc = _tbc;

    # register profiles (agent notification)
    vortex.register_profile (tbc.vortex_ctx, URN,
                             frame_received=frame_received)

    # return initialization ok
    tbc.msg ("Test 13: python-test initialized")
    return True
Exemplo n.º 2
0
    if frame.type == 'MSG':
       # reply doing an echo
       channel.send_rpy (frame.payload, frame.payload_size, frame.msg_no)

    return
    # end default_frame_received

# create a vortex.Ctx object
ctx = vortex.Ctx ()

# now, init the context and check status
if not ctx.init ():
   print ("ERROR: Unable to init ctx, failed to continue")
   sys.exit (-1)

# ctx created

# register support for a profile
vortex.register_profile (ctx, "urn:aspl.es:beep:profiles:my-profile",
                         frame_received=default_frame_received)

# start listener and check status
listener = vortex.create_listener (ctx, "0.0.0.0", "1602")

if not listener.is_ok ():
   print ("ERROR: failed to start listener, error was was: " + listener.error_msg)
   sys.exit (-1)

# wait for requests
vortex.wait_listeners (ctx, unlock_on_signal=True)
    # create a context
    ctx = vortex.Ctx ()

    # init context
    if not ctx.init ():
        error ("Unable to init ctx, failed to start listener")
        sys.exit(-1)

    # configure signal handling
    signal.signal (signal.SIGTERM, signal_handler)
    signal.signal (signal.SIGINT, signal_handler)
    signal.signal (signal.SIGQUIT, signal_handler)

    # register all profiles used 
    vortex.register_profile (ctx, REGRESSION_URI,
                             frame_received=default_frame_received)
    vortex.register_profile (ctx, REGRESSION_URI_ZERO,
                             frame_received=default_frame_received)
    vortex.register_profile (ctx, REGRESSION_URI_DENY_SUPPORTED,
                             start=deny_supported)
    vortex.register_profile (ctx, REGRESSION_URI_ANS,
                             frame_received=frame_replies_ans)
    vortex.register_profile (ctx, REGRESSION_URI_START_CLOSE,
                             start=close_conn)
    vortex.register_profile (ctx, REGRESSION_URI_RECORD_CONN,
                             start=record_conn)
    vortex.register_profile (ctx, REGRESSION_URI_CLOSE_RECORDED_CONN,
                             start=close_recorded_conn)
    
    # enable sasl listener support
    vortex.sasl.accept_mech (ctx, "plain", sasl_auth_handler)
    # create a context
    ctx = vortex.Ctx()

    # init context
    if not ctx.init():
        error("Unable to init ctx, failed to start listener")
        sys.exit(-1)

    # configure signal handling
    signal.signal(signal.SIGTERM, signal_handler)
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGQUIT, signal_handler)

    # register all profiles used
    vortex.register_profile(ctx,
                            REGRESSION_URI,
                            frame_received=default_frame_received)
    vortex.register_profile(ctx,
                            REGRESSION_URI_ZERO,
                            frame_received=default_frame_received)
    vortex.register_profile(ctx,
                            REGRESSION_URI_DENY_SUPPORTED,
                            start=deny_supported)
    vortex.register_profile(ctx,
                            REGRESSION_URI_ANS,
                            frame_received=frame_replies_ans)
    vortex.register_profile(ctx, REGRESSION_URI_START_CLOSE, start=close_conn)
    vortex.register_profile(ctx, REGRESSION_URI_RECORD_CONN, start=record_conn)
    vortex.register_profile(ctx,
                            REGRESSION_URI_CLOSE_RECORDED_CONN,
                            start=close_recorded_conn)
Exemplo n.º 5
0
    return
    # end default_frame_received


# create a vortex.Ctx object
ctx = vortex.Ctx()

# now, init the context and check status
if not ctx.init():
    print("ERROR: Unable to init ctx, failed to continue")
    sys.exit(-1)

# ctx created

# register support for a profile
vortex.register_profile(ctx,
                        "urn:aspl.es:beep:profiles:my-profile",
                        frame_received=default_frame_received)

# start listener and check status
listener = vortex.create_listener(ctx, "0.0.0.0", "1602")

if not listener.is_ok():
    print("ERROR: failed to start listener, error was was: " +
          listener.error_msg)
    sys.exit(-1)

# wait for requests
vortex.wait_listeners(ctx, unlock_on_signal=True)