diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-09 15:38:31 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-09 15:38:31 +0000 |
| commit | 02280779752e70cb21e59f0b1606b0653c2b036b (patch) | |
| tree | 682e3e7f05c0e0bc892a396cf891760d4048d6ef /python | |
| parent | c4aecc092871e9be240419f9ce93b9543786da44 (diff) | |
| download | lasso-02280779752e70cb21e59f0b1606b0653c2b036b.tar.gz lasso-02280779752e70cb21e59f0b1606b0653c2b036b.tar.xz lasso-02280779752e70cb21e59f0b1606b0653c2b036b.zip | |
initial version : binding for logout
Diffstat (limited to 'python')
| -rw-r--r-- | python/environs/py_logout.c | 143 | ||||
| -rw-r--r-- | python/environs/py_logout.h | 46 |
2 files changed, 189 insertions, 0 deletions
diff --git a/python/environs/py_logout.c b/python/environs/py_logout.c new file mode 100644 index 00000000..ac565552 --- /dev/null +++ b/python/environs/py_logout.c @@ -0,0 +1,143 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "../lassomod.h" + +#include "py_logout.h" + +PyObject *LassoLogout_wrap(LassoLogout *logout) { + PyObject *ret; + + if (logout == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) logout, + (char *) "LassoLogout *", NULL); + return (ret); +} + +/******************************************************************************/ + +PyObject *logout_new(PyObject *self, PyObject *args) { + PyObject *server_obj, *user_obj; + LassoLogout *logout; + gint provider_type; + + if (CheckArgs(args, "OOI:logout_new")) { + if(!PyArg_ParseTuple(args, (char *) "OOi:logout_new", + &server_obj, &user_obj, &provider_type)) + return NULL; + } + else return NULL; + + logout = lasso_logout_new(LassoServer_get(server_obj), + LassoUser_get(user_obj), + provider_type); + + return (LassoLogout_wrap(logout)); +} + +PyObject *logout_build_request_msg(PyObject *self, PyObject *args) { + PyObject *logout_obj; + gint codeError; + + if (CheckArgs(args, "O:logout_build_request_msg")) { + if(!PyArg_ParseTuple(args, (char *) "O:logout_build_request_msg", + &logout_obj)) + return NULL; + } + else return NULL; + + codeError = lasso_logout_build_request_msg(LassoLogout_get(logout_obj)); + + return(int_wrap(codeError)); +} + +PyObject *logout_build_response_msg(PyObject *self, PyObject *args) { + PyObject *logout_obj; + gint codeError; + + if (CheckArgs(args, "O:logout_build_response_msg")) { + if(!PyArg_ParseTuple(args, (char *) "O:logout_build_response_msg", + &logout_obj)) + return NULL; + } + else return NULL; + + codeError = lasso_logout_build_response_msg(LassoLogout_get(logout_obj)); + + return(int_wrap(codeError)); +} + +PyObject *logout_init_request(PyObject *self, PyObject *args) { + PyObject *logout_obj; + gchar *remote_providerID; + + if (CheckArgs(args, "OS:logout_init_request")) { + if(!PyArg_ParseTuple(args, (char *) "Os:logout_init_request", + &logout_obj, &remote_providerID)) + return NULL; + } + else return NULL; + + codeError = logout_init_request(LassoLogout_get(logout_obj), remote_providerID); + + return(int_wrap(codeError)); +} + +PyObject *logout_handle_request(PyObject *self, PyObject *args) { + PyObject *logout_obj; + gchar *request_msg; + gint request_method; + + if (CheckArgs(args, "OSI:logout_handle_request")) { + if(!PyArg_ParseTuple(args, (char *) "Osi:logout_handle_request", + &logout_obj, &request_msg, &request_method)) + return NULL; + } + else return NULL; + + codeError = logout_init_request(LassoLogout_get(logout_obj), request_msg, request_method); + + return(int_wrap(codeError)); +} + +PyObject *logout_handle_response(PyObject *self, PyObject *args) { + PyObject *logout_obj; + gchar *response_msg; + gint response_method; + + if (CheckArgs(args, "OSI:logout_handle_response")) { + if(!PyArg_ParseTuple(args, (char *) "Osi:logout_handle_response", + &logout_obj, &response_msg, &response_method)) + return NULL; + } + else return NULL; + + codeError = logout_init_request(LassoLogout_get(logout_obj), response_msg, response_method); + + return(int_wrap(codeError)); +} diff --git a/python/environs/py_logout.h b/python/environs/py_logout.h new file mode 100644 index 00000000..9bd8e5b6 --- /dev/null +++ b/python/environs/py_logout.h @@ -0,0 +1,46 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PYLASSO_PY_LOGOUT_H__ +#define __PYLASSO_PY_LOGOUT_H__ + +#include <lasso/environs/logout.h> + +typedef struct { + PyObject_HEAD + LassoLogout *obj; +} LassoLogout_object; + +#define LassoLogout_get(v) (((v) == Py_None) ? NULL : (((LassoLogout_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) +PyObject *LassoLogout_wrap(LassoLogout *logout); + +PyObject *logout_new(PyObject *self, PyObject *args); +PyObject *logout_build_request_msg(PyObject *self, PyObject *args); +PyObject *logout_build_response_msg(PyObject *self, PyObject *args); +PyObject *logout_init_request(PyObject *self, PyObject *args); +PyObject *logout_handle_request(PyObject *self, PyObject *args) +PyObject *logout_handle_response(PyObject *self, PyObject *args); + +#endif /* __PYLASSO_PY_LOGOUT_H__ */ |
