inc/addr.pxd
author Tero Marttila <terom@fixme.fi>
Sun, 16 Aug 2009 03:12:46 +0300
changeset 1 0ca9278146d7
child 2 171e77f8d675
permissions -rw-r--r--
move pxd's to inc dir, split off sctp.pxd
cimport libc

cdef class sockaddr :
    """
        A network-level socket address

        >>> sockaddr().family
        0
        >>> sockaddr().port
        Traceback (most recent call last):
          ...
        NotImplementedError
        >>> sockaddr().getnameinfo()
        Traceback (most recent call last):
          ...
        NotImplementedError
    """
    
    # address family
    # XXX: this should be a class constant! It's part of our type safety!
    cdef readonly libc.sa_family_t family

    cdef void _init_family (self, libc.sa_family_t family=?)

    # get the sockaddr/socklen
    # each of these can be NULL to ignore it
    cdef int _get_sockaddr (self, libc.sockaddr **sa_ptr, libc.socklen_t *sa_len) except -1