123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- /*
- * 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 <http://www.gnu.org/licenses/>.
- */
-
- /**@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 <fcgiapp.h>
- #include <fcgi_stdio.h> /* fcgi library; put it first */
-
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
- #include "structmember.h"
-
- #include <limits.h>
- #include <stdlib.h>
-
- #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
|