nxt_perl_psgi_layer.h (1689:e0d01647db76) nxt_perl_psgi_layer.h (2060:a1991578c62e)
1
2/*
3 * Copyright (C) Alexander Borisov
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_PERL_PSGI_LAYER_H_INCLUDED_
8#define _NXT_PERL_PSGI_LAYER_H_INCLUDED_
9
10
11#include <EXTERN.h>
12#include <XSUB.h>
13#include <perl.h>
14#include <perliol.h>
15
16
1
2/*
3 * Copyright (C) Alexander Borisov
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_PERL_PSGI_LAYER_H_INCLUDED_
8#define _NXT_PERL_PSGI_LAYER_H_INCLUDED_
9
10
11#include <EXTERN.h>
12#include <XSUB.h>
13#include <perl.h>
14#include <perliol.h>
15
16
17typedef struct nxt_perl_psgi_io_tab_s nxt_perl_psgi_io_tab_t;
17typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t;
18
18typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t;
19
19typedef long (*nxt_perl_psgi_io_read_f)(PerlInterpreter *my_perl,
20 nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length);
21typedef long (*nxt_perl_psgi_io_write_f)(PerlInterpreter *my_perl,
22 nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length);
23typedef long (*nxt_perl_psgi_io_arg_f)(PerlInterpreter *my_perl,
24 nxt_perl_psgi_io_arg_t *arg);
25
20
21struct nxt_perl_psgi_io_tab_s {
22 SSize_t (*read)(PerlInterpreter *my_perl,
23 nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length);
24 SSize_t (*write)(PerlInterpreter *my_perl,
25 nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length);
26};
26
27
28
27struct nxt_perl_psgi_io_arg_s {
29struct nxt_perl_psgi_io_arg_s {
28 SV *io;
29 PerlIO *fp;
30 SV *rv;
31 SV *io;
32 PerlIO *fp;
30
33
31 nxt_perl_psgi_io_arg_f flush;
32 nxt_perl_psgi_io_read_f read;
33 nxt_perl_psgi_io_write_f write;
34 const nxt_perl_psgi_io_tab_t *io_tab;
34
35
35 void *pctx;
36 void *req;
36};
37
38
39void nxt_perl_psgi_layer_stream_init(pTHX);
40
37};
38
39
40void nxt_perl_psgi_layer_stream_init(pTHX);
41
41PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg,
42PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ SV *arg_rv,
42 const char *mode);
43void nxt_perl_psgi_layer_stream_fp_destroy(pTHX_ PerlIO *io);
44
45SV *nxt_perl_psgi_layer_stream_io_create(pTHX_ PerlIO *fp);
43 const char *mode);
44void nxt_perl_psgi_layer_stream_fp_destroy(pTHX_ PerlIO *io);
45
46SV *nxt_perl_psgi_layer_stream_io_create(pTHX_ PerlIO *fp);
46void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio);
47
48#endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */
47
48#endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */