Beispiel #1
0
def p_interface_call(p):
    '''interface_call : IDENTIFIER OPAREN interface_call_param_list CPAREN
                      | IDENTIFIER OPAREN CPAREN
                      | IDENTIFIER OPAREN interface_call_param_list CPAREN SEMI'''
    # Allow spurious semi-colons at the end of interface calls
    i = refpolicy.InterfaceCall(ifname=p[1])
    if len(p) > 4:
        i.args.extend(p[3])
    p[0] = i
Beispiel #2
0
def call_interface(interface, av):
    params = []
    args = []

    params.extend(interface.params.values())
    params.sort(param_comp)

    ifcall = refpolicy.InterfaceCall()
    ifcall.ifname = interface.name

    for i in range(len(params)):
        if params[i].type == refpolicy.SRC_TYPE:
            ifcall.args.append(av.src_type)
        elif params[i].type == refpolicy.TGT_TYPE:
            ifcall.args.append(av.tgt_type)
        elif params[i].type == refpolicy.OBJ_CLASS:
            ifcall.args.append(av.obj_class)
        else:
            print params[i].type
            assert (0)

    assert (len(ifcall.args) > 0)

    return ifcall
Beispiel #3
0
def p_interface_call(p):
    'interface_call : IDENTIFIER OPAREN interface_call_param_list CPAREN'
    i = refpolicy.InterfaceCall(ifname=p[1])

    i.args.extend(p[3])
    p[0] = i