/* * Copyright (C) 2019 Weber Yann * * This file is part of PyFCGI. * * PyFCGI is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * PyFCGI 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with PyFCGI. If not, see . */ /**@defgroup lib_ioin Defines libpyfcgi.IoIn class * @brief The IoIn class implement base IO interface allowing python to read * HTTP request from FCGI * @ingroup libpyfcgo */ /**@file python_ioin.h * @ingroup lib_ioin */ #ifndef _PYTHON_IOIN__H__ #define _PYTHON_IOIN__H__ #include "config.h" #include #include /* fcgi library; put it first */ #define PY_SSIZE_T_CLEAN #include #include "structmember.h" #include #include #define IoIn__FromString(self, str) \ (((IoIn*)self)->bin?PyBytes_FromString:PyUnicode_FromString)(str) #define IoIn__FromBuff(self) IoIn__FromString(self, ((IoIn*)self)->buff) extern PyMethodDef IoIn_methods[]; extern PyMemberDef IoIn_members[]; extern PyTypeObject IoInType; typedef struct { PyObject_VAR_HEAD; PyObject *closed; FCGX_Stream **in_stream; char *buff; /**@brief buffer size */ int buff_sz; /**@brief 1 if binary stream (sending PyBytes) 0 if sending PyUnicode */ short bin; /**@brief 1 if EOF encountered, else 0 */ short eof; } IoIn; int pyfcgi_ioin_init(PyObject *self, PyObject *args, PyObject *kwds); void pyfcgi_ioin_del(IoIn *self); PyObject* pyfcgi_ioin_close(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_fileno(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_flush(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_isatty(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_readable(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_readline(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_readlines(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_read(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_readall(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_readinto(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_WriteError(PyObject *self, PyObject **argv, Py_ssize_t argc); #define pyfcgi_ioin_writelines pyfcgi_ioin_WriteError #define pyfcgi_ioin_write pyfcgi_ioin_WriteError PyObject* pyfcgi_ioin_SeekError(PyObject *self, PyObject **argv, Py_ssize_t argc); #define pyfcgi_ioin_seek pyfcgi_ioin_SeekError #define pyfcgi_ioin_tell pyfcgi_ioin_SeekError PyObject* pyfcgi_ioin_truncate(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_seekable(PyObject *self, PyObject **argv, Py_ssize_t argc); PyObject* pyfcgi_ioin_writable(PyObject *self, PyObject **argv, Py_ssize_t argc); #endif