nxt_perl_psgi_layer.h (1108:8788f96701d5) nxt_perl_psgi_layer.h (1689:e0d01647db76)
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_arg nxt_perl_psgi_io_arg_t;
17typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t;
18
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
26
18
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
26
27struct nxt_perl_psgi_io_arg {
27struct nxt_perl_psgi_io_arg_s {
28 SV *io;
29 PerlIO *fp;
30
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
28 SV *io;
29 PerlIO *fp;
30
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
35 void *ctx;
35 void *pctx;
36};
37
38
39void nxt_perl_psgi_layer_stream_init(pTHX);
40
41PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg,
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);
46void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio);
47
48#endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */
36};
37
38
39void nxt_perl_psgi_layer_stream_init(pTHX);
40
41PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg,
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);
46void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio);
47
48#endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */