xref: /unit/src/perl/nxt_perl_psgi_layer.h (revision 1689)
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*1689Smax.romanov@nginx.com typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t;
18510Salexander.borisov@nginx.com 
19510Salexander.borisov@nginx.com typedef long (*nxt_perl_psgi_io_read_f)(PerlInterpreter *my_perl,
20510Salexander.borisov@nginx.com     nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length);
21510Salexander.borisov@nginx.com typedef long (*nxt_perl_psgi_io_write_f)(PerlInterpreter *my_perl,
22510Salexander.borisov@nginx.com     nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length);
23510Salexander.borisov@nginx.com typedef long (*nxt_perl_psgi_io_arg_f)(PerlInterpreter *my_perl,
24510Salexander.borisov@nginx.com     nxt_perl_psgi_io_arg_t *arg);
25510Salexander.borisov@nginx.com 
26510Salexander.borisov@nginx.com 
27*1689Smax.romanov@nginx.com struct nxt_perl_psgi_io_arg_s {
28510Salexander.borisov@nginx.com     SV                        *io;
29510Salexander.borisov@nginx.com     PerlIO                    *fp;
30510Salexander.borisov@nginx.com 
31510Salexander.borisov@nginx.com     nxt_perl_psgi_io_arg_f    flush;
32510Salexander.borisov@nginx.com     nxt_perl_psgi_io_read_f   read;
33510Salexander.borisov@nginx.com     nxt_perl_psgi_io_write_f  write;
34510Salexander.borisov@nginx.com 
35*1689Smax.romanov@nginx.com     void                      *pctx;
36510Salexander.borisov@nginx.com };
37510Salexander.borisov@nginx.com 
38510Salexander.borisov@nginx.com 
39510Salexander.borisov@nginx.com void nxt_perl_psgi_layer_stream_init(pTHX);
40510Salexander.borisov@nginx.com 
41510Salexander.borisov@nginx.com PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg,
42510Salexander.borisov@nginx.com     const char *mode);
43510Salexander.borisov@nginx.com void nxt_perl_psgi_layer_stream_fp_destroy(pTHX_ PerlIO *io);
44510Salexander.borisov@nginx.com 
45510Salexander.borisov@nginx.com SV *nxt_perl_psgi_layer_stream_io_create(pTHX_ PerlIO *fp);
46510Salexander.borisov@nginx.com void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio);
47510Salexander.borisov@nginx.com 
48510Salexander.borisov@nginx.com #endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */
49