nxt_perl_psgi_layer.h (510:4979fe09d9cd) nxt_perl_psgi_layer.h (780:0de745fae82c)
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
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#define _GNU_SOURCE
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;
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 {
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;
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_ */
12#include <EXTERN.h>
13#include <XSUB.h>
14#include <perl.h>
15#include <perliol.h>
16
17
18typedef struct nxt_perl_psgi_io_arg nxt_perl_psgi_io_arg_t;
19
20typedef long (*nxt_perl_psgi_io_read_f)(PerlInterpreter *my_perl,
21 nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length);
22typedef long (*nxt_perl_psgi_io_write_f)(PerlInterpreter *my_perl,
23 nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length);
24typedef long (*nxt_perl_psgi_io_arg_f)(PerlInterpreter *my_perl,
25 nxt_perl_psgi_io_arg_t *arg);
26
27
28struct nxt_perl_psgi_io_arg {
29 SV *io;
30 PerlIO *fp;
31
32 nxt_perl_psgi_io_arg_f flush;
33 nxt_perl_psgi_io_read_f read;
34 nxt_perl_psgi_io_write_f write;
35
36 void *ctx;
37};
38
39
40void nxt_perl_psgi_layer_stream_init(pTHX);
41
42PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg,
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);
47void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio);
48
49#endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */