Exemplo n.º 1
0
def tcpBind(stream, address, port):
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpBind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Exemplo n.º 2
0
def tcpConnect(stream, address, port, callback):
    connect = alloc_connect()
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpConnect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Exemplo n.º 3
0
Arquivo: ruv.py Projeto: dckc/typhon
def tcpBind(stream, address, port):
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpBind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Exemplo n.º 4
0
Arquivo: ruv.py Projeto: dckc/typhon
def tcpConnect(stream, address, port, callback):
    connect = alloc_connect()
    rffi.setintfield(sin, "c_sin_family", s.AF_INET)
    rffi.setintfield(sin, "c_sin_port", s.htons(port))
    if inet_pton(s.AF_INET, address, sin.c_sin_addr):
        print "tcpConnect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Exemplo n.º 5
0
def tcp6Connect(stream, address, port, callback):
    inet, sin, s_addr, s_fam, s_port = af6

    connect = alloc_connect()
    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Connect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Exemplo n.º 6
0
def tcp6Bind(stream, address, port):
    inet, sin, s_addr, s_fam, s_port = af6

    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Bind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Exemplo n.º 7
0
def tcp6Connect(stream, address, port, callback):
    inet, sin, s_addr, s_fam, s_port = af6

    connect = alloc_connect()
    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Connect: inet_pton failed!?"
        assert False

    rv = check("tcp_connect", tcp_connect(connect, stream, sin, callback))
    return rv
Exemplo n.º 8
0
def tcp6Bind(stream, address, port):
    inet, sin, s_addr, s_fam, s_port = af6

    rffi.setintfield(sin, s_fam, inet)
    rffi.setintfield(sin, s_port, s.htons(port))
    if inet_pton(inet, address, getattr(sin, s_addr)):
        print "tcp6Bind: inet_pton failed!?"
        assert False

    # No flags.
    rv = check("tcp_bind", tcp_bind(stream, sin, 0))
    return rv
Exemplo n.º 9
0
def htons(x):
    assert isinstance(x, int)
    return rffi.cast(lltype.Signed, _c.htons(x))
Exemplo n.º 10
0
def htons(x):
    return rffi.cast(lltype.Signed, _c.htons(x))
Exemplo n.º 11
0
def htons(x):
    assert isinstance(x, int)
    return rffi.cast(lltype.Signed, _c.htons(x))