コード例 #1
0
ファイル: family.py プロジェクト: kimocoder/libnl-1
def family_constructor(c):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/family.c#L37.

    Positional arguments:
    c -- nl_object-derived class instance.
    """
    family = c
    if not hasattr(family, 'gf_ops'):
        setattr(family, 'gf_ops', nl_list_head(container_of=family))
    if not hasattr(family, 'gf_mc_grps'):
        setattr(family, 'gf_mc_grps', nl_list_head(container_of=family))
    nl_init_list_head(family.gf_ops)
    nl_init_list_head(family.gf_mc_grps)
コード例 #2
0
ファイル: family.py プロジェクト: 0x90/libnl
def family_constructor(c):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/family.c#L37.

    Positional arguments:
    c -- nl_object-derived class instance.
    """
    family = c
    if not hasattr(family, 'gf_ops'):
        setattr(family, 'gf_ops', nl_list_head(container_of=family))
    if not hasattr(family, 'gf_mc_grps'):
        setattr(family, 'gf_mc_grps', nl_list_head(container_of=family))
    nl_init_list_head(family.gf_ops)
    nl_init_list_head(family.gf_mc_grps)
コード例 #3
0
def nl_object_alloc(ops):
    """Allocate a new object of kind specified by the operations handle.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/object.c#L54

    Positional arguments:
    ops -- cache operations handle (nl_object_ops class instance).

    Returns:
    New nl_object class instance or None.
    """
    new = nl_object()
    nl_init_list_head(new.ce_list)
    new.ce_ops = ops
    if ops.oo_constructor:
        ops.oo_constructor(new)
    _LOGGER.debug('Allocated new object 0x%x', id(new))
    return new