00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PYTHON_USER_H_
00021
00022 #define __PYTHON_USER_H_
00023
00024 #include <Python.h>
00025
00026 typedef struct {
00027 PyObject_HEAD
00028 char * name;
00029 char * session;
00030 } ekg_userObj;
00031
00032 PyObject * python_build_user(char * session, const char * name);
00033 PyObject * ekg_user_repr(ekg_userObj * self);
00034 PyObject * ekg_user_str(ekg_userObj * self);
00035 void ekg_user_dealloc(ekg_userObj * o);
00036 int ekg_user_init(ekg_userObj *self, PyObject *args, PyObject *kwds);
00037 PyObject *ekg_user_groups(ekg_userObj * self);
00038 PyObject *ekg_user_get_attr(ekg_userObj * self, char * attr);
00039
00040 staticforward PyMethodDef ekg_user_methods[] = {
00041 {"groups", (PyCFunction)ekg_user_groups, METH_NOARGS, "Returns groups user belongs to"},
00042 {NULL, NULL, 0, NULL}
00043 };
00044
00045 static PyTypeObject ekg_user_type = {
00046 PyObject_HEAD_INIT(NULL)
00047 0,
00048 "user",
00049 sizeof(ekg_userObj),
00050 0,
00051 (destructor)ekg_user_dealloc,
00052 0,
00053 (getattrfunc)ekg_user_get_attr,
00054 0,
00055 0,
00056 (reprfunc)ekg_user_repr,
00057 0,
00058 0,
00059 0,
00060 0,
00061 0,
00062 (reprfunc)ekg_user_str,
00063 0,
00064 0,
00065 0,
00066 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
00067 "User object",
00068 0,
00069 0,
00070 0,
00071 0,
00072 0,
00073 0,
00074 ekg_user_methods,
00075 0,
00076 0,
00077 0,
00078 0,
00079 0,
00080 0,
00081 0,
00082 (initproc)ekg_user_init,
00083 0,
00084 0,
00085 };
00086
00087 #endif
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097