void analyze_nfs4_operations()

in src/analysis/nfs_parser.cpp [325:380]


void analyze_nfs4_operations(Analyzers& analyzers, NFS4CompoundType& nfs4_compound_procedure)
{
    ArgOpType* arg{nullptr};
    ResOpType* res{nullptr};

    uint32_t arg_ops_count{0}; // Amount of NFS operations (call part)
    uint32_t res_ops_count{0}; // Amount of NFS operations (reply part)
    uint32_t total_ops_count{0};

    if(nfs4_compound_procedure.parg) // Checking if COMPOUND procedure has valid arg
    {
        arg_ops_count = nfs4_compound_procedure.parg->argarray.argarray_len;
        arg           = nfs4_compound_procedure.parg->argarray.argarray_val;
    }

    if(nfs4_compound_procedure.pres) // Checking if COMPOUND procedure has valid res
    {
        res_ops_count = nfs4_compound_procedure.pres->resarray.resarray_len;
        res           = nfs4_compound_procedure.pres->resarray.resarray_val;
    }

    // Determing which part of COMPOUND has the biggest amount of operations.
    total_ops_count = arg_ops_count > res_ops_count ? arg_ops_count : res_ops_count;

    // Traversing through ALL COMPOUND procedure's operations
    for(uint32_t i{0}; i < total_ops_count; i++)
    {
        if((arg && res) && (arg->argop != res->resop))
        {
            // Passing each operation to analyzers using the helper's function
            nfs4_ops_switch(analyzers, &nfs4_compound_procedure, arg, nullptr);
            nfs4_ops_switch(analyzers, &nfs4_compound_procedure, nullptr, res);
        }
        else
        {
            nfs4_ops_switch(analyzers, &nfs4_compound_procedure, arg, res);
        }

        if(arg && i < (arg_ops_count - 1))
        {
            arg++;
        }
        else
        {
            arg = nullptr;
        }
        if(res && i < (res_ops_count - 1))
        {
            res++;
        }
        else
        {
            res = nullptr;
        }
    }
}