xref: /unit/src/perl/nxt_perl_psgi_layer.h (revision 2060:a1991578c62e)
1510Salexander.borisov@nginx.com 
2510Salexander.borisov@nginx.com /*
3510Salexander.borisov@nginx.com  * Copyright (C) Alexander Borisov
4510Salexander.borisov@nginx.com  * Copyright (C) NGINX, Inc.
5510Salexander.borisov@nginx.com  */
6510Salexander.borisov@nginx.com 
7510Salexander.borisov@nginx.com #ifndef _NXT_PERL_PSGI_LAYER_H_INCLUDED_
8510Salexander.borisov@nginx.com #define _NXT_PERL_PSGI_LAYER_H_INCLUDED_
9510Salexander.borisov@nginx.com 
10510Salexander.borisov@nginx.com 
11510Salexander.borisov@nginx.com #include <EXTERN.h>
12510Salexander.borisov@nginx.com #include <XSUB.h>
13510Salexander.borisov@nginx.com #include <perl.h>
14510Salexander.borisov@nginx.com #include <perliol.h>
15510Salexander.borisov@nginx.com 
16510Salexander.borisov@nginx.com 
17*2060Smax.romanov@nginx.com typedef struct nxt_perl_psgi_io_tab_s nxt_perl_psgi_io_tab_t;
181689Smax.romanov@nginx.com typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t;
19510Salexander.borisov@nginx.com 
20*2060Smax.romanov@nginx.com 
21*2060Smax.romanov@nginx.com struct nxt_perl_psgi_io_tab_s {
22*2060Smax.romanov@nginx.com     SSize_t (*read)(PerlInterpreter *my_perl,
23*2060Smax.romanov@nginx.com         nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length);
24*2060Smax.romanov@nginx.com     SSize_t (*write)(PerlInterpreter *my_perl,
25*2060Smax.romanov@nginx.com         nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length);
26*2060Smax.romanov@nginx.com };
27510Salexander.borisov@nginx.com 
28510Salexander.borisov@nginx.com 
291689Smax.romanov@nginx.com struct nxt_perl_psgi_io_arg_s {
30*2060Smax.romanov@nginx.com     SV                            *rv;
31*2060Smax.romanov@nginx.com     SV                            *io;
32*2060Smax.romanov@nginx.com     PerlIO                        *fp;
33510Salexander.borisov@nginx.com 
34*2060Smax.romanov@nginx.com     const nxt_perl_psgi_io_tab_t  *io_tab;
35510Salexander.borisov@nginx.com 
36*2060Smax.romanov@nginx.com     void                          *req;
37510Salexander.borisov@nginx.com };
38510Salexander.borisov@nginx.com 
39510Salexander.borisov@nginx.com 
40510Salexander.borisov@nginx.com void nxt_perl_psgi_layer_stream_init(pTHX);
41510Salexander.borisov@nginx.com 
42*2060Smax.romanov@nginx.com PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ SV *arg_rv,
43510Salexander.borisov@nginx.com     const char *mode);
44510Salexander.borisov@nginx.com void nxt_perl_psgi_layer_stream_fp_destroy(pTHX_ PerlIO *io);
45510Salexander.borisov@nginx.com 
46510Salexander.borisov@nginx.com SV *nxt_perl_psgi_layer_stream_io_create(pTHX_ PerlIO *fp);
47510Salexander.borisov@nginx.com 
48510Salexander.borisov@nginx.com #endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */
49