Пример #1
0
PyObject *xmlSecTransform_getattr(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;
  const char *attr;

  if (CheckArgs(args, "OS:transformGetAttr")) {
    if (!PyArg_ParseTuple(args, "Os:transformGetAttr",
			  &transform_obj, &attr))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[ssssssssss]", "id", "operation", "status",
			 "hereNode", "next", "prev", "inBuf", "outBuf",
			 "inNodes", "outNodes");
  if (!strcmp(attr, "id"))
    return (wrap_xmlSecTransformId(transform->id));
  if (!strcmp(attr, "operation"))
    return (wrap_int(transform->operation));
  if (!strcmp(attr, "status"))
    return (wrap_int(transform->status));
  if (!strcmp(attr, "hereNode"))
    return (wrap_xmlNodePtr(transform->hereNode));
  if (!strcmp(attr, "next"))
    return (wrap_xmlSecTransformPtr(transform->next));
  if (!strcmp(attr, "prev"))
    return (wrap_xmlSecTransformPtr(transform->prev));
  if (!strcmp(attr, "inBuf"))
    return (wrap_xmlSecBufferPtr(&(transform->inBuf)));
  if (!strcmp(attr, "outBuf"))
    return (wrap_xmlSecBufferPtr(&(transform->outBuf)));
  if (!strcmp(attr, "inNodes"))
    return (wrap_xmlSecNodeSetPtr(transform->inNodes));
  if (!strcmp(attr, "outNodes"))
    return (wrap_xmlSecNodeSetPtr(transform->outNodes));

  Py_INCREF(Py_None);
  return (Py_None);
}
Пример #2
0
PyObject *xmlSecNodeSet_getattr(PyObject *self, PyObject *args) {
  PyObject *nset_obj;
  xmlSecNodeSetPtr nset;
  const char *attr;

  if (CheckArgs(args, "OS:nodeSetGetAttr")) {
    if (!PyArg_ParseTuple(args, "Os:nodeSetGetAttr",
			  &nset_obj, &attr))
      return NULL;
  }
  else return NULL;

  nset = xmlSecNodeSetPtr_get(nset_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[ssssssss]", "nodes", "doc", "destroyDoc", "type",
			 "op", "next", "prev", "children");
  if (!strcmp(attr, "nodes"))
    return (wrap_xmlNodeSetPtr(nset->nodes));
  if (!strcmp(attr, "doc"))
    return (wrap_xmlDocPtr(nset->doc));
  if (!strcmp(attr, "destroyDoc"))
    return (wrap_int(nset->destroyDoc));
  if (!strcmp(attr, "type"))
    return (wrap_int(nset->type));
  if (!strcmp(attr, "op"))
    return (wrap_int(nset->op));
  if (!strcmp(attr, "next"))
    return (wrap_xmlSecNodeSetPtr(nset->next));
  if (!strcmp(attr, "prev"))
    return (wrap_xmlSecNodeSetPtr(nset->prev));
  if (!strcmp(attr, "children"))
    return (wrap_xmlSecNodeSetPtr(nset->children));

  Py_INCREF(Py_None);
  return (Py_None);
}
Пример #3
0
PyObject *xmlsec_NodeSetAddList(PyObject *self, PyObject *args) {
  PyObject *nset_obj, *newNSet_obj;
  xmlSecNodeSetPtr nset;
  xmlSecNodeSetPtr newNSet;
  xmlSecNodeSetOp op;

  if (CheckArgs(args, "OOI:nodeSetAddList")) {
    if (!PyArg_ParseTuple(args, "OOi:nodeSetAddList", &nset_obj, &newNSet_obj,
			  &op))
      return NULL;
  }
  else return NULL;

  nset = xmlSecNodeSetPtr_get(nset_obj);
  newNSet = xmlSecNodeSetPtr_get(newNSet_obj);

  return (wrap_xmlSecNodeSetPtr(xmlSecNodeSetAddList(nset, newNSet, op)));
}
Пример #4
0
PyObject *xmlsec_NodeSetCreate(PyObject *self, PyObject *args) {
  PyObject *doc_obj, *nodes_obj;
  xmlDocPtr doc;
  xmlNodeSetPtr nodes;
  xmlSecNodeSetType type;

  if (CheckArgs(args, "OOI:nodeSetCreate")) {
    if (!PyArg_ParseTuple(args, "OOi:nodeSetCreate", &doc_obj, &nodes_obj,
			  &type))
      return NULL;
  }
  else return NULL;

  doc = xmlDocPtr_get(doc_obj);
  nodes = xmlNodeSetPtr_get(nodes_obj);

  return (wrap_xmlSecNodeSetPtr(xmlSecNodeSetCreate(doc, nodes, type)));
}
Пример #5
0
static int xmlsec_NodeSetWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur,
				      xmlNodePtr parent, void *data) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup2(NodeSetWalkCallbacks, (const xmlChar *)nset->doc->name,
			nset->doc->URL);

  args = Py_BuildValue((char *) "OOOO", wrap_xmlSecNodeSetPtr(nset),
		       wrap_xmlNodePtr(cur), wrap_xmlNodePtr(parent),
		       PyCObject_FromVoidPtr((void *) data, NULL));

  /* Protect refcount against reentrant manipulation of callback hash */
  Py_INCREF(func);
  result = PyEval_CallObject(func, args);
  Py_DECREF(func);
  Py_DECREF(args);

  return (PyInt_AsLong(result));
}
Пример #6
0
PyObject *xmlsec_NodeSetGetChildren(PyObject *self, PyObject *args) {
  PyObject *doc_obj, *parent_obj;
  xmlDocPtr doc;
  xmlNodePtr parent = NULL;
  int withComments, invert;
  xmlSecNodeSetPtr cnset;

  if (CheckArgs(args, "OoII:nodeSetGetChildren")) {
    if (!PyArg_ParseTuple(args, "OOii:nodeSetGetChildren", &doc_obj,
			  &parent_obj, &withComments, &invert))
      return NULL;
  }
  else return NULL;

  doc = xmlDocPtr_get(doc_obj);
  parent = xmlNodePtr_get(parent_obj);
  cnset = xmlSecNodeSetGetChildren(doc, parent, withComments, invert);

  return (wrap_xmlSecNodeSetPtr(cnset));
}