python-module/cpplmodule.cc
/**
 * Get compressed cppl policy from file.
 */
Get compressed cppl policy from file.
Get compressed cppl policy from file .
static PyObject *cpplmodule_read_compressed_cppl_from_file(PyObject *self, PyObject *args)
{
  PyObject *retval;
  char *ccpplFilePath;
  long long pd_key;
  PolicyDefinition *pd;
  PolicyStack *compressed_policy;
  if (!PyArg_ParseTuple(args, "sL", &ccpplFilePath, &pd_key)) {
    return NULL;
  }
  pd = pd_list.at(pd_key);
  try {
    compressed_policy = cppl_read_compressed_cppl_from_file(ccpplFilePath, pd);
  }
  catch (std::runtime_error e) {
    return PyErr_Format(CpplError, "%s", e.what());
  }
  catch (std::string s) {
    return PyErr_Format(CpplError, "%s", s.c_str());
  }
  long long ps_key = (long long)compressed_policy;
  ps_list[ps_key] = compressed_policy;
  retval = Py_BuildValue("L", ps_key);
  return retval;
}
static PyObject * cpplmodule_read_compressed_cppl_from_file ( PyObject * self , PyObject * args ) { PyObject * retval ; char * ccpplFilePath ; long long pd_key ; PolicyDefinition * pd ; PolicyStack * compressed_policy ; if ( ! PyArg_ParseTuple ( args , " " , & ccpplFilePath , & pd_key ) ) { return NULL ; } pd = pd_list . at ( pd_key ) ; try { compressed_policy = cppl_read_compressed_cppl_from_file ( ccpplFilePath , pd ) ; } catch ( std :: runtime_error e ) { return PyErr_Format ( CpplError , " " , e . what ( ) ) ; } catch ( std :: string s ) { return PyErr_Format ( CpplError , " " , s . c_str ( ) ) ; } long long ps_key = ( long long ) compressed_policy ; ps_list [ ps_key ] = compressed_policy ; retval = Py_BuildValue ( " " , ps_key ) ; return retval ; }
Get compressed cppl policy from file.
Get compressed cppl policy from file .