line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the |
3
|
|
|
|
|
|
|
* contents of SockAddr.xs. Do not edit this file, edit SockAddr.xs instead. |
4
|
|
|
|
|
|
|
* |
5
|
|
|
|
|
|
|
* ANY CHANGES MADE HERE WILL BE LOST! |
6
|
|
|
|
|
|
|
* |
7
|
|
|
|
|
|
|
*/ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#line 1 "SockAddr.xs" |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
#include |
12
|
|
|
|
|
|
|
#include |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
using namespace xs; |
15
|
|
|
|
|
|
|
using namespace xs::exp; |
16
|
|
|
|
|
|
|
using namespace panda::net; |
17
|
|
|
|
|
|
|
using panda::string; |
18
|
|
|
|
|
|
|
using panda::string_view; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
template |
21
|
|
|
|
|
|
|
static inline string_view addr2sv (const T& addr) { return string_view((const char*)&addr, sizeof(T)); } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#line 24 "SockAddr_xsgen.cc" |
24
|
|
|
|
|
|
|
#ifndef PERL_UNUSED_VAR |
25
|
|
|
|
|
|
|
# define PERL_UNUSED_VAR(var) if (0) var = var |
26
|
|
|
|
|
|
|
#endif |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#ifndef dVAR |
29
|
|
|
|
|
|
|
# define dVAR dNOOP |
30
|
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
/* This stuff is not part of the API! You have been warned. */ |
34
|
|
|
|
|
|
|
#ifndef PERL_VERSION_DECIMAL |
35
|
|
|
|
|
|
|
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
36
|
|
|
|
|
|
|
#endif |
37
|
|
|
|
|
|
|
#ifndef PERL_DECIMAL_VERSION |
38
|
|
|
|
|
|
|
# define PERL_DECIMAL_VERSION \ |
39
|
|
|
|
|
|
|
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
40
|
|
|
|
|
|
|
#endif |
41
|
|
|
|
|
|
|
#ifndef PERL_VERSION_GE |
42
|
|
|
|
|
|
|
# define PERL_VERSION_GE(r,v,s) \ |
43
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
44
|
|
|
|
|
|
|
#endif |
45
|
|
|
|
|
|
|
#ifndef PERL_VERSION_LE |
46
|
|
|
|
|
|
|
# define PERL_VERSION_LE(r,v,s) \ |
47
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
48
|
|
|
|
|
|
|
#endif |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
/* XS_INTERNAL is the explicit static-linkage variant of the default |
51
|
|
|
|
|
|
|
* XS macro. |
52
|
|
|
|
|
|
|
* |
53
|
|
|
|
|
|
|
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
54
|
|
|
|
|
|
|
* "STATIC", ie. it exports XSUB symbols. You probably don't want that |
55
|
|
|
|
|
|
|
* for anything but the BOOT XSUB. |
56
|
|
|
|
|
|
|
* |
57
|
|
|
|
|
|
|
* See XSUB.h in core! |
58
|
|
|
|
|
|
|
*/ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
/* TODO: This might be compatible further back than 5.10.0. */ |
62
|
|
|
|
|
|
|
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
63
|
|
|
|
|
|
|
# undef XS_EXTERNAL |
64
|
|
|
|
|
|
|
# undef XS_INTERNAL |
65
|
|
|
|
|
|
|
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
66
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
67
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
68
|
|
|
|
|
|
|
# endif |
69
|
|
|
|
|
|
|
# if defined(__SYMBIAN32__) |
70
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
71
|
|
|
|
|
|
|
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) |
72
|
|
|
|
|
|
|
# endif |
73
|
|
|
|
|
|
|
# ifndef XS_EXTERNAL |
74
|
|
|
|
|
|
|
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
75
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
76
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) |
77
|
|
|
|
|
|
|
# else |
78
|
|
|
|
|
|
|
# ifdef __cplusplus |
79
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
80
|
|
|
|
|
|
|
# define XS_INTERNAL(name) static XSPROTO(name) |
81
|
|
|
|
|
|
|
# else |
82
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XSPROTO(name) |
83
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
84
|
|
|
|
|
|
|
# endif |
85
|
|
|
|
|
|
|
# endif |
86
|
|
|
|
|
|
|
# endif |
87
|
|
|
|
|
|
|
#endif |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
/* perl >= 5.10.0 && perl <= 5.15.1 */ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
/* The XS_EXTERNAL macro is used for functions that must not be static |
93
|
|
|
|
|
|
|
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
94
|
|
|
|
|
|
|
* macro defined, the best we can do is assume XS is the same. |
95
|
|
|
|
|
|
|
* Dito for XS_INTERNAL. |
96
|
|
|
|
|
|
|
*/ |
97
|
|
|
|
|
|
|
#ifndef XS_EXTERNAL |
98
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XS(name) |
99
|
|
|
|
|
|
|
#endif |
100
|
|
|
|
|
|
|
#ifndef XS_INTERNAL |
101
|
|
|
|
|
|
|
# define XS_INTERNAL(name) XS(name) |
102
|
|
|
|
|
|
|
#endif |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
105
|
|
|
|
|
|
|
* internal macro that we're free to redefine for varying linkage due |
106
|
|
|
|
|
|
|
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
107
|
|
|
|
|
|
|
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
108
|
|
|
|
|
|
|
*/ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#undef XS_EUPXS |
111
|
|
|
|
|
|
|
#if defined(PERL_EUPXS_ALWAYS_EXPORT) |
112
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_EXTERNAL(name) |
113
|
|
|
|
|
|
|
#else |
114
|
|
|
|
|
|
|
/* default to internal */ |
115
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_INTERNAL(name) |
116
|
|
|
|
|
|
|
#endif |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
119
|
|
|
|
|
|
|
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
/* prototype to pass -Wmissing-prototypes */ |
122
|
|
|
|
|
|
|
STATIC void |
123
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
STATIC void |
126
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params) |
127
|
|
|
|
|
|
|
{ |
128
|
|
|
|
|
|
|
const GV *const gv = CvGV(cv); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
if (gv) { |
133
|
|
|
|
|
|
|
const char *const gvname = GvNAME(gv); |
134
|
|
|
|
|
|
|
const HV *const stash = GvSTASH(gv); |
135
|
|
|
|
|
|
|
const char *const hvname = stash ? HvNAME(stash) : NULL; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
if (hvname) |
138
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
139
|
|
|
|
|
|
|
else |
140
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
141
|
|
|
|
|
|
|
} else { |
142
|
|
|
|
|
|
|
/* Pants. I don't think that it should be possible to get here. */ |
143
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
#define croak_xs_usage S_croak_xs_usage |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#endif |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
/* NOTE: the prototype of newXSproto() is different in versions of perls, |
153
|
|
|
|
|
|
|
* so we define a portable version of newXSproto() |
154
|
|
|
|
|
|
|
*/ |
155
|
|
|
|
|
|
|
#ifdef newXS_flags |
156
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
157
|
|
|
|
|
|
|
#else |
158
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
159
|
|
|
|
|
|
|
#endif /* !defined(newXS_flags) */ |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
162
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
163
|
|
|
|
|
|
|
#else |
164
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
165
|
|
|
|
|
|
|
#endif |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
#line 168 "SockAddr_xsgen.cc" |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
10
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_new) { xs::throw_guard(cv, [=]() |
171
|
|
|
|
|
|
|
{ |
172
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
173
|
5
|
50
|
|
|
|
|
if (items != 2) |
174
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "CLASS, oth"); |
175
|
|
|
|
|
|
|
{ |
176
|
5
|
|
|
|
|
|
SockAddr RETVAL; |
177
|
5
|
|
|
|
|
|
SV* CLASS = ST(0) |
178
|
|
|
|
|
|
|
; |
179
|
5
|
50
|
|
|
|
|
SockAddr oth = xs::in(ST(1)); |
180
|
|
|
|
|
|
|
; |
181
|
|
|
|
|
|
|
#line 46 "SockAddr.xs" |
182
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
183
|
|
|
|
|
|
|
PROTO = CLASS; |
184
|
|
|
|
|
|
|
RETVAL = oth; |
185
|
|
|
|
|
|
|
#line 186 "SockAddr_xsgen.cc" |
186
|
|
|
|
|
|
|
{ |
187
|
|
|
|
|
|
|
SV * RETVALSV; |
188
|
5
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
189
|
5
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
190
|
5
|
|
|
|
|
|
ST(0) = RETVALSV; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
} |
193
|
5
|
|
|
|
|
|
XSRETURN(1); |
194
|
5
|
50
|
|
|
|
|
}); } |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_family) { xs::throw_guard(cv, [=]() |
199
|
|
|
|
|
|
|
{ |
200
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
201
|
3
|
50
|
|
|
|
|
if (items != 1) |
202
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
203
|
|
|
|
|
|
|
{ |
204
|
|
|
|
|
|
|
sa_family_t RETVAL; |
205
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
206
|
|
|
|
|
|
|
; |
207
|
|
|
|
|
|
|
#line 49 "SockAddr.xs" |
208
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
209
|
|
|
|
|
|
|
RETVAL = THIS->family(); |
210
|
|
|
|
|
|
|
#line 211 "SockAddr_xsgen.cc" |
211
|
|
|
|
|
|
|
{ |
212
|
|
|
|
|
|
|
SV * RETVALSV; |
213
|
3
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
214
|
3
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
215
|
3
|
|
|
|
|
|
ST(0) = RETVALSV; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
} |
218
|
3
|
|
|
|
|
|
XSRETURN(1); |
219
|
3
|
50
|
|
|
|
|
}); } |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
|
223
|
4
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_is_inet4) { xs::throw_guard(cv, [=]() |
224
|
|
|
|
|
|
|
{ |
225
|
2
|
|
|
|
|
|
dVAR; dXSARGS; |
226
|
2
|
50
|
|
|
|
|
if (items != 1) |
227
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
228
|
|
|
|
|
|
|
{ |
229
|
|
|
|
|
|
|
bool RETVAL; |
230
|
2
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
231
|
|
|
|
|
|
|
; |
232
|
|
|
|
|
|
|
#line 51 "SockAddr.xs" |
233
|
|
|
|
|
|
|
RETVAL = THIS->is_inet4(); |
234
|
|
|
|
|
|
|
#line 235 "SockAddr_xsgen.cc" |
235
|
2
|
50
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
236
|
|
|
|
|
|
|
} |
237
|
2
|
|
|
|
|
|
XSRETURN(1); |
238
|
2
|
50
|
|
|
|
|
}); } |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
2
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_is_inet6) { xs::throw_guard(cv, [=]() |
243
|
|
|
|
|
|
|
{ |
244
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
245
|
1
|
50
|
|
|
|
|
if (items != 1) |
246
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
247
|
|
|
|
|
|
|
{ |
248
|
|
|
|
|
|
|
bool RETVAL; |
249
|
1
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
250
|
|
|
|
|
|
|
; |
251
|
|
|
|
|
|
|
#line 53 "SockAddr.xs" |
252
|
|
|
|
|
|
|
RETVAL = THIS->is_inet6(); |
253
|
|
|
|
|
|
|
#line 254 "SockAddr_xsgen.cc" |
254
|
1
|
50
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
255
|
|
|
|
|
|
|
} |
256
|
1
|
|
|
|
|
|
XSRETURN(1); |
257
|
1
|
50
|
|
|
|
|
}); } |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
#ifndef _WIN32 |
260
|
|
|
|
|
|
|
#define XSubPPtmpAAAA 1 |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
2
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_is_unix) { xs::throw_guard(cv, [=]() |
265
|
|
|
|
|
|
|
{ |
266
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
267
|
1
|
50
|
|
|
|
|
if (items != 1) |
268
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
269
|
|
|
|
|
|
|
{ |
270
|
|
|
|
|
|
|
bool RETVAL; |
271
|
1
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
272
|
|
|
|
|
|
|
; |
273
|
|
|
|
|
|
|
#line 57 "SockAddr.xs" |
274
|
|
|
|
|
|
|
RETVAL = THIS->is_unix(); |
275
|
|
|
|
|
|
|
#line 276 "SockAddr_xsgen.cc" |
276
|
1
|
50
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
277
|
|
|
|
|
|
|
} |
278
|
1
|
|
|
|
|
|
XSRETURN(1); |
279
|
1
|
50
|
|
|
|
|
}); } |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#endif |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
8
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr_get) { xs::throw_guard(cv, [=]() |
285
|
|
|
|
|
|
|
{ |
286
|
4
|
|
|
|
|
|
dVAR; dXSARGS; |
287
|
4
|
50
|
|
|
|
|
if (items != 1) |
288
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
289
|
|
|
|
|
|
|
{ |
290
|
4
|
|
|
|
|
|
string_view RETVAL; |
291
|
4
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
292
|
4
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
293
|
|
|
|
|
|
|
; |
294
|
|
|
|
|
|
|
#line 62 "SockAddr.xs" |
295
|
|
|
|
|
|
|
if (THIS->family() == AF_UNSPEC) XSRETURN_UNDEF; |
296
|
|
|
|
|
|
|
RETVAL = string_view((const char*)THIS->get(), THIS->length()); |
297
|
|
|
|
|
|
|
#line 298 "SockAddr_xsgen.cc" |
298
|
4
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
299
|
|
|
|
|
|
|
} |
300
|
4
|
|
|
|
|
|
XSRETURN(1); |
301
|
4
|
50
|
|
|
|
|
}); } |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__to_string) { xs::throw_guard(cv, [=]() |
306
|
|
|
|
|
|
|
{ |
307
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
308
|
3
|
50
|
|
|
|
|
if (items < 1) |
309
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, ..."); |
310
|
|
|
|
|
|
|
{ |
311
|
6
|
|
|
|
|
|
std::string RETVAL; |
312
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
50
|
|
|
|
|
|
313
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
314
|
|
|
|
|
|
|
; |
315
|
|
|
|
|
|
|
#line 67 "SockAddr.xs" |
316
|
|
|
|
|
|
|
std::ostringstream os; |
317
|
|
|
|
|
|
|
os << *THIS; |
318
|
|
|
|
|
|
|
RETVAL = os.str(); |
319
|
|
|
|
|
|
|
#line 320 "SockAddr_xsgen.cc" |
320
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
321
|
|
|
|
|
|
|
} |
322
|
3
|
|
|
|
|
|
XSRETURN(1); |
323
|
3
|
50
|
|
|
|
|
}); } |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
|
327
|
14
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__eq) { xs::throw_guard(cv, [=]() |
328
|
|
|
|
|
|
|
{ |
329
|
7
|
|
|
|
|
|
dVAR; dXSARGS; |
330
|
7
|
50
|
|
|
|
|
if (items < 2) |
331
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, oth, ..."); |
332
|
|
|
|
|
|
|
{ |
333
|
|
|
|
|
|
|
bool RETVAL; |
334
|
7
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
335
|
|
|
|
|
|
|
; |
336
|
7
|
50
|
|
|
|
|
SockAddr oth = xs::in(ST(1)); |
337
|
|
|
|
|
|
|
; |
338
|
|
|
|
|
|
|
#line 72 "SockAddr.xs" |
339
|
|
|
|
|
|
|
RETVAL = *THIS == oth; |
340
|
|
|
|
|
|
|
#line 341 "SockAddr_xsgen.cc" |
341
|
7
|
50
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
342
|
|
|
|
|
|
|
} |
343
|
7
|
|
|
|
|
|
XSRETURN(1); |
344
|
7
|
50
|
|
|
|
|
}); } |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
|
348
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__ne) { xs::throw_guard(cv, [=]() |
349
|
|
|
|
|
|
|
{ |
350
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
351
|
3
|
50
|
|
|
|
|
if (items < 2) |
352
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS, oth, ..."); |
353
|
|
|
|
|
|
|
{ |
354
|
|
|
|
|
|
|
bool RETVAL; |
355
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
356
|
|
|
|
|
|
|
; |
357
|
3
|
50
|
|
|
|
|
SockAddr oth = xs::in(ST(1)); |
358
|
|
|
|
|
|
|
; |
359
|
|
|
|
|
|
|
#line 74 "SockAddr.xs" |
360
|
|
|
|
|
|
|
RETVAL = *THIS != oth; |
361
|
|
|
|
|
|
|
#line 362 "SockAddr_xsgen.cc" |
362
|
3
|
50
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
363
|
|
|
|
|
|
|
} |
364
|
3
|
|
|
|
|
|
XSRETURN(1); |
365
|
3
|
50
|
|
|
|
|
}); } |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
|
369
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet4_from_addr) { xs::throw_guard(cv, [=]() |
370
|
|
|
|
|
|
|
{ |
371
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
372
|
3
|
50
|
|
|
|
|
if (items != 2) |
373
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "addr, port"); |
374
|
|
|
|
|
|
|
{ |
375
|
3
|
|
|
|
|
|
SockAddr RETVAL; |
376
|
3
|
|
|
|
|
|
string_view addr; |
377
|
3
|
50
|
|
|
|
|
uint16_t port = (uint16_t)SvUV(ST(1)) |
|
|
50
|
|
|
|
|
|
378
|
|
|
|
|
|
|
; |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
{ STRLEN __addr_len; |
381
|
3
|
50
|
|
|
|
|
const char* __addr_buf = SvPV(ST(0), __addr_len); |
|
|
0
|
|
|
|
|
|
382
|
3
|
|
|
|
|
|
addr = decltype(addr)(__addr_buf, __addr_len); } |
383
|
|
|
|
|
|
|
; |
384
|
|
|
|
|
|
|
#line 80 "SockAddr.xs" |
385
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
386
|
|
|
|
|
|
|
if (addr.length() != sizeof(in_addr)) throw "invalid ip4 addr"; |
387
|
|
|
|
|
|
|
RETVAL = SockAddr::Inet4(*(const in_addr*)addr.data(), port); |
388
|
|
|
|
|
|
|
#line 389 "SockAddr_xsgen.cc" |
389
|
|
|
|
|
|
|
{ |
390
|
|
|
|
|
|
|
SV * RETVALSV; |
391
|
3
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
392
|
3
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
393
|
3
|
|
|
|
|
|
ST(0) = RETVALSV; |
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
} |
396
|
3
|
|
|
|
|
|
XSRETURN(1); |
397
|
3
|
50
|
|
|
|
|
}); } |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
20
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet4_new) { xs::throw_guard(cv, [=]() |
402
|
|
|
|
|
|
|
{ |
403
|
10
|
|
|
|
|
|
dVAR; dXSARGS; |
404
|
10
|
50
|
|
|
|
|
if (items != 3) |
405
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "SV*, ip, port"); |
406
|
|
|
|
|
|
|
{ |
407
|
10
|
|
|
|
|
|
SockAddr RETVAL; |
408
|
10
|
|
|
|
|
|
string_view ip; |
409
|
10
|
50
|
|
|
|
|
uint16_t port = (uint16_t)SvUV(ST(2)) |
|
|
50
|
|
|
|
|
|
410
|
|
|
|
|
|
|
; |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
{ STRLEN __ip_len; |
413
|
10
|
50
|
|
|
|
|
const char* __ip_buf = SvPV(ST(1), __ip_len); |
|
|
0
|
|
|
|
|
|
414
|
10
|
|
|
|
|
|
ip = decltype(ip)(__ip_buf, __ip_len); } |
415
|
|
|
|
|
|
|
; |
416
|
|
|
|
|
|
|
#line 85 "SockAddr.xs" |
417
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
418
|
|
|
|
|
|
|
RETVAL = SockAddr::Inet4(ip, port); |
419
|
|
|
|
|
|
|
#line 420 "SockAddr_xsgen.cc" |
420
|
|
|
|
|
|
|
{ |
421
|
|
|
|
|
|
|
SV * RETVALSV; |
422
|
9
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
423
|
9
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
424
|
9
|
|
|
|
|
|
ST(0) = RETVALSV; |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
} |
427
|
9
|
|
|
|
|
|
XSRETURN(1); |
428
|
10
|
50
|
|
|
|
|
}); } |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
|
432
|
8
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet4_ip) { xs::throw_guard(cv, [=]() |
433
|
|
|
|
|
|
|
{ |
434
|
4
|
|
|
|
|
|
dVAR; dXSARGS; |
435
|
4
|
50
|
|
|
|
|
if (items != 1) |
436
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
437
|
|
|
|
|
|
|
{ |
438
|
8
|
|
|
|
|
|
string RETVAL; |
439
|
4
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
440
|
4
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
441
|
|
|
|
|
|
|
; |
442
|
|
|
|
|
|
|
#line 89 "SockAddr.xs" |
443
|
|
|
|
|
|
|
RETVAL = THIS->inet4().ip(); |
444
|
|
|
|
|
|
|
#line 445 "SockAddr_xsgen.cc" |
445
|
4
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
446
|
|
|
|
|
|
|
} |
447
|
4
|
|
|
|
|
|
XSRETURN(1); |
448
|
4
|
50
|
|
|
|
|
}); } |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
|
452
|
8
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet4_port) { xs::throw_guard(cv, [=]() |
453
|
|
|
|
|
|
|
{ |
454
|
4
|
|
|
|
|
|
dVAR; dXSARGS; |
455
|
4
|
50
|
|
|
|
|
if (items != 1) |
456
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
457
|
|
|
|
|
|
|
{ |
458
|
|
|
|
|
|
|
uint16_t RETVAL; |
459
|
4
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
460
|
4
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
461
|
|
|
|
|
|
|
; |
462
|
|
|
|
|
|
|
#line 93 "SockAddr.xs" |
463
|
|
|
|
|
|
|
RETVAL = THIS->inet4().port(); |
464
|
|
|
|
|
|
|
#line 465 "SockAddr_xsgen.cc" |
465
|
4
|
50
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
50
|
|
|
|
|
|
466
|
|
|
|
|
|
|
} |
467
|
4
|
|
|
|
|
|
XSRETURN(1); |
468
|
4
|
50
|
|
|
|
|
}); } |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
472
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet4_addr) { xs::throw_guard(cv, [=]() |
473
|
|
|
|
|
|
|
{ |
474
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
475
|
3
|
50
|
|
|
|
|
if (items != 1) |
476
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
477
|
|
|
|
|
|
|
{ |
478
|
3
|
|
|
|
|
|
string_view RETVAL; |
479
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
480
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
481
|
|
|
|
|
|
|
; |
482
|
|
|
|
|
|
|
#line 97 "SockAddr.xs" |
483
|
|
|
|
|
|
|
RETVAL = addr2sv(THIS->inet4().addr()); |
484
|
|
|
|
|
|
|
#line 485 "SockAddr_xsgen.cc" |
485
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
486
|
|
|
|
|
|
|
} |
487
|
3
|
|
|
|
|
|
XSRETURN(1); |
488
|
3
|
50
|
|
|
|
|
}); } |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
492
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_from_addr) { xs::throw_guard(cv, [=]() |
493
|
|
|
|
|
|
|
{ |
494
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
495
|
3
|
50
|
|
|
|
|
if (items < 2 || items > 4) |
|
|
50
|
|
|
|
|
|
496
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "addr, port, scope_id= 0, flow_info= 0"); |
497
|
|
|
|
|
|
|
{ |
498
|
3
|
|
|
|
|
|
SockAddr RETVAL; |
499
|
3
|
|
|
|
|
|
string_view addr; |
500
|
3
|
50
|
|
|
|
|
uint16_t port = (uint16_t)SvUV(ST(1)) |
|
|
50
|
|
|
|
|
|
501
|
|
|
|
|
|
|
; |
502
|
|
|
|
|
|
|
uint32_t scope_id; |
503
|
|
|
|
|
|
|
uint32_t flow_info; |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
{ STRLEN __addr_len; |
506
|
3
|
50
|
|
|
|
|
const char* __addr_buf = SvPV(ST(0), __addr_len); |
|
|
0
|
|
|
|
|
|
507
|
3
|
|
|
|
|
|
addr = decltype(addr)(__addr_buf, __addr_len); } |
508
|
|
|
|
|
|
|
; |
509
|
|
|
|
|
|
|
|
510
|
3
|
100
|
|
|
|
|
if (items < 3) |
511
|
2
|
|
|
|
|
|
scope_id = 0; |
512
|
|
|
|
|
|
|
else { |
513
|
1
|
50
|
|
|
|
|
scope_id = (uint32_t)SvUV(ST(2)) |
514
|
2
|
50
|
|
|
|
|
; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
3
|
100
|
|
|
|
|
if (items < 4) |
518
|
2
|
|
|
|
|
|
flow_info = 0; |
519
|
|
|
|
|
|
|
else { |
520
|
1
|
50
|
|
|
|
|
flow_info = (uint32_t)SvUV(ST(3)) |
521
|
2
|
50
|
|
|
|
|
; |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
#line 105 "SockAddr.xs" |
524
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
525
|
|
|
|
|
|
|
if (addr.length() != sizeof(in6_addr)) throw "invalid ip6 addr"; |
526
|
|
|
|
|
|
|
RETVAL = SockAddr::Inet6(*(const in6_addr*)addr.data(), port, scope_id, flow_info); |
527
|
|
|
|
|
|
|
#line 528 "SockAddr_xsgen.cc" |
528
|
|
|
|
|
|
|
{ |
529
|
|
|
|
|
|
|
SV * RETVALSV; |
530
|
3
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
531
|
3
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
532
|
3
|
|
|
|
|
|
ST(0) = RETVALSV; |
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
} |
535
|
3
|
|
|
|
|
|
XSRETURN(1); |
536
|
3
|
50
|
|
|
|
|
}); } |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
|
540
|
10
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_new) { xs::throw_guard(cv, [=]() |
541
|
|
|
|
|
|
|
{ |
542
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
543
|
5
|
50
|
|
|
|
|
if (items < 3 || items > 5) |
|
|
50
|
|
|
|
|
|
544
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "SV*, ip, port, scope_id= 0, flow_info= 0"); |
545
|
|
|
|
|
|
|
{ |
546
|
5
|
|
|
|
|
|
SockAddr RETVAL; |
547
|
5
|
|
|
|
|
|
string_view ip; |
548
|
5
|
50
|
|
|
|
|
uint16_t port = (uint16_t)SvUV(ST(2)) |
|
|
50
|
|
|
|
|
|
549
|
|
|
|
|
|
|
; |
550
|
|
|
|
|
|
|
uint32_t scope_id; |
551
|
|
|
|
|
|
|
uint32_t flow_info; |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
{ STRLEN __ip_len; |
554
|
5
|
50
|
|
|
|
|
const char* __ip_buf = SvPV(ST(1), __ip_len); |
|
|
0
|
|
|
|
|
|
555
|
5
|
|
|
|
|
|
ip = decltype(ip)(__ip_buf, __ip_len); } |
556
|
|
|
|
|
|
|
; |
557
|
|
|
|
|
|
|
|
558
|
5
|
100
|
|
|
|
|
if (items < 4) |
559
|
4
|
|
|
|
|
|
scope_id = 0; |
560
|
|
|
|
|
|
|
else { |
561
|
1
|
50
|
|
|
|
|
scope_id = (uint32_t)SvUV(ST(3)) |
562
|
2
|
50
|
|
|
|
|
; |
563
|
|
|
|
|
|
|
} |
564
|
|
|
|
|
|
|
|
565
|
5
|
100
|
|
|
|
|
if (items < 5) |
566
|
4
|
|
|
|
|
|
flow_info = 0; |
567
|
|
|
|
|
|
|
else { |
568
|
1
|
50
|
|
|
|
|
flow_info = (uint32_t)SvUV(ST(4)) |
569
|
2
|
50
|
|
|
|
|
; |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
#line 110 "SockAddr.xs" |
572
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
573
|
|
|
|
|
|
|
RETVAL = SockAddr::Inet6(ip, port, scope_id, flow_info); |
574
|
|
|
|
|
|
|
#line 575 "SockAddr_xsgen.cc" |
575
|
|
|
|
|
|
|
{ |
576
|
|
|
|
|
|
|
SV * RETVALSV; |
577
|
4
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
578
|
4
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
579
|
4
|
|
|
|
|
|
ST(0) = RETVALSV; |
580
|
|
|
|
|
|
|
} |
581
|
|
|
|
|
|
|
} |
582
|
4
|
|
|
|
|
|
XSRETURN(1); |
583
|
5
|
50
|
|
|
|
|
}); } |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
|
587
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_ip) { xs::throw_guard(cv, [=]() |
588
|
|
|
|
|
|
|
{ |
589
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
590
|
3
|
50
|
|
|
|
|
if (items != 1) |
591
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
592
|
|
|
|
|
|
|
{ |
593
|
6
|
|
|
|
|
|
string RETVAL; |
594
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
595
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
596
|
|
|
|
|
|
|
; |
597
|
|
|
|
|
|
|
#line 114 "SockAddr.xs" |
598
|
|
|
|
|
|
|
RETVAL = THIS->inet6().ip(); |
599
|
|
|
|
|
|
|
#line 600 "SockAddr_xsgen.cc" |
600
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
601
|
|
|
|
|
|
|
} |
602
|
3
|
|
|
|
|
|
XSRETURN(1); |
603
|
3
|
50
|
|
|
|
|
}); } |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
|
607
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_port) { xs::throw_guard(cv, [=]() |
608
|
|
|
|
|
|
|
{ |
609
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
610
|
3
|
50
|
|
|
|
|
if (items != 1) |
611
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
612
|
|
|
|
|
|
|
{ |
613
|
|
|
|
|
|
|
uint16_t RETVAL; |
614
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
615
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
616
|
|
|
|
|
|
|
; |
617
|
|
|
|
|
|
|
#line 118 "SockAddr.xs" |
618
|
|
|
|
|
|
|
RETVAL = THIS->inet6().port(); |
619
|
|
|
|
|
|
|
#line 620 "SockAddr_xsgen.cc" |
620
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
50
|
|
|
|
|
|
621
|
|
|
|
|
|
|
} |
622
|
3
|
|
|
|
|
|
XSRETURN(1); |
623
|
3
|
50
|
|
|
|
|
}); } |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
|
627
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_scope_id) { xs::throw_guard(cv, [=]() |
628
|
|
|
|
|
|
|
{ |
629
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
630
|
3
|
50
|
|
|
|
|
if (items != 1) |
631
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
632
|
|
|
|
|
|
|
{ |
633
|
|
|
|
|
|
|
uint32_t RETVAL; |
634
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
635
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
636
|
|
|
|
|
|
|
; |
637
|
|
|
|
|
|
|
#line 122 "SockAddr.xs" |
638
|
|
|
|
|
|
|
RETVAL = THIS->inet6().scope_id(); |
639
|
|
|
|
|
|
|
#line 640 "SockAddr_xsgen.cc" |
640
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
50
|
|
|
|
|
|
641
|
|
|
|
|
|
|
} |
642
|
3
|
|
|
|
|
|
XSRETURN(1); |
643
|
3
|
50
|
|
|
|
|
}); } |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
|
647
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_flowinfo) { xs::throw_guard(cv, [=]() |
648
|
|
|
|
|
|
|
{ |
649
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
650
|
3
|
50
|
|
|
|
|
if (items != 1) |
651
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
652
|
|
|
|
|
|
|
{ |
653
|
|
|
|
|
|
|
uint32_t RETVAL; |
654
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
655
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
656
|
|
|
|
|
|
|
; |
657
|
|
|
|
|
|
|
#line 126 "SockAddr.xs" |
658
|
|
|
|
|
|
|
RETVAL = THIS->inet6().flowinfo(); |
659
|
|
|
|
|
|
|
#line 660 "SockAddr_xsgen.cc" |
660
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
50
|
|
|
|
|
|
661
|
|
|
|
|
|
|
} |
662
|
3
|
|
|
|
|
|
XSRETURN(1); |
663
|
3
|
50
|
|
|
|
|
}); } |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
|
667
|
4
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Inet6_addr) { xs::throw_guard(cv, [=]() |
668
|
|
|
|
|
|
|
{ |
669
|
2
|
|
|
|
|
|
dVAR; dXSARGS; |
670
|
2
|
50
|
|
|
|
|
if (items != 1) |
671
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
672
|
|
|
|
|
|
|
{ |
673
|
2
|
|
|
|
|
|
string_view RETVAL; |
674
|
2
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
675
|
2
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
676
|
|
|
|
|
|
|
; |
677
|
|
|
|
|
|
|
#line 130 "SockAddr.xs" |
678
|
|
|
|
|
|
|
RETVAL = addr2sv(THIS->inet6().addr()); |
679
|
|
|
|
|
|
|
#line 680 "SockAddr_xsgen.cc" |
680
|
2
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
681
|
|
|
|
|
|
|
} |
682
|
2
|
|
|
|
|
|
XSRETURN(1); |
683
|
2
|
50
|
|
|
|
|
}); } |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
#ifndef _WIN32 |
686
|
|
|
|
|
|
|
#define XSubPPtmpAAAB 1 |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
|
690
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Unix_new) { xs::throw_guard(cv, [=]() |
691
|
|
|
|
|
|
|
{ |
692
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
693
|
3
|
50
|
|
|
|
|
if (items != 2) |
694
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "SV*, path"); |
695
|
|
|
|
|
|
|
{ |
696
|
3
|
|
|
|
|
|
SockAddr RETVAL; |
697
|
3
|
|
|
|
|
|
string_view path; |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
{ STRLEN __path_len; |
700
|
3
|
50
|
|
|
|
|
const char* __path_buf = SvPV(ST(1), __path_len); |
|
|
0
|
|
|
|
|
|
701
|
3
|
|
|
|
|
|
path = decltype(path)(__path_buf, __path_len); } |
702
|
|
|
|
|
|
|
; |
703
|
|
|
|
|
|
|
#line 140 "SockAddr.xs" |
704
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
705
|
|
|
|
|
|
|
RETVAL = SockAddr::Unix(path); |
706
|
|
|
|
|
|
|
#line 707 "SockAddr_xsgen.cc" |
707
|
|
|
|
|
|
|
{ |
708
|
|
|
|
|
|
|
SV * RETVALSV; |
709
|
2
|
50
|
|
|
|
|
RETVALSV = xs::out(RETVAL, PROTO).detach(); |
710
|
2
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
711
|
2
|
|
|
|
|
|
ST(0) = RETVALSV; |
712
|
|
|
|
|
|
|
} |
713
|
|
|
|
|
|
|
} |
714
|
2
|
|
|
|
|
|
XSRETURN(1); |
715
|
3
|
50
|
|
|
|
|
}); } |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
|
719
|
6
|
|
|
|
|
|
XS_EUPXS(XS_Net__SockAddr__Unix_path) { xs::throw_guard(cv, [=]() |
720
|
|
|
|
|
|
|
{ |
721
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
722
|
3
|
50
|
|
|
|
|
if (items != 1) |
723
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
724
|
|
|
|
|
|
|
{ |
725
|
3
|
|
|
|
|
|
string_view RETVAL; |
726
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
727
|
3
|
50
|
|
|
|
|
SockAddr* THIS = xs::in(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
728
|
|
|
|
|
|
|
; |
729
|
|
|
|
|
|
|
#line 144 "SockAddr.xs" |
730
|
|
|
|
|
|
|
RETVAL = THIS->unix().path(); |
731
|
|
|
|
|
|
|
#line 732 "SockAddr_xsgen.cc" |
732
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
733
|
|
|
|
|
|
|
} |
734
|
3
|
|
|
|
|
|
XSRETURN(1); |
735
|
3
|
50
|
|
|
|
|
}); } |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
#endif |
738
|
|
|
|
|
|
|
#ifdef __cplusplus |
739
|
|
|
|
|
|
|
extern "C" |
740
|
|
|
|
|
|
|
#endif |
741
|
|
|
|
|
|
|
|
742
|
10
|
|
|
|
|
|
XS_EXTERNAL(boot_Net__SockAddr) { xs::throw_guard(cv, [=]() mutable |
743
|
|
|
|
|
|
|
{ |
744
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
745
|
|
|
|
|
|
|
dVAR; dXSARGS; |
746
|
|
|
|
|
|
|
#else |
747
|
5
|
50
|
|
|
|
|
dVAR; dXSBOOTARGSXSAPIVERCHK; |
|
|
50
|
|
|
|
|
|
748
|
|
|
|
|
|
|
#endif |
749
|
|
|
|
|
|
|
#if (PERL_REVISION == 5 && PERL_VERSION < 9) |
750
|
|
|
|
|
|
|
char* file = __FILE__; |
751
|
|
|
|
|
|
|
#else |
752
|
5
|
|
|
|
|
|
const char* file = __FILE__; |
753
|
|
|
|
|
|
|
#endif |
754
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
PERL_UNUSED_VAR(file); |
756
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
PERL_UNUSED_VAR(cv); /* -W */ |
758
|
|
|
|
|
|
|
PERL_UNUSED_VAR(items); /* -W */ |
759
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
760
|
|
|
|
|
|
|
XS_VERSION_BOOTCHECK; |
761
|
|
|
|
|
|
|
# ifdef XS_APIVERSION_BOOTCHECK |
762
|
|
|
|
|
|
|
XS_APIVERSION_BOOTCHECK; |
763
|
|
|
|
|
|
|
# endif |
764
|
|
|
|
|
|
|
#endif |
765
|
|
|
|
|
|
|
|
766
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::new", XS_Net__SockAddr_new); |
767
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::family", XS_Net__SockAddr_family); |
768
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::is_inet4", XS_Net__SockAddr_is_inet4); |
769
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::is_inet6", XS_Net__SockAddr_is_inet6); |
770
|
|
|
|
|
|
|
#if XSubPPtmpAAAA |
771
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::is_unix", XS_Net__SockAddr_is_unix); |
772
|
|
|
|
|
|
|
#endif |
773
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::get", XS_Net__SockAddr_get); |
774
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::_to_string", XS_Net__SockAddr__to_string); |
775
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::_eq", XS_Net__SockAddr__eq); |
776
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::_ne", XS_Net__SockAddr__ne); |
777
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet4::from_addr", XS_Net__SockAddr__Inet4_from_addr); |
778
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet4::new", XS_Net__SockAddr__Inet4_new); |
779
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet4::ip", XS_Net__SockAddr__Inet4_ip); |
780
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet4::port", XS_Net__SockAddr__Inet4_port); |
781
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet4::addr", XS_Net__SockAddr__Inet4_addr); |
782
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::from_addr", XS_Net__SockAddr__Inet6_from_addr); |
783
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::new", XS_Net__SockAddr__Inet6_new); |
784
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::ip", XS_Net__SockAddr__Inet6_ip); |
785
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::port", XS_Net__SockAddr__Inet6_port); |
786
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::scope_id", XS_Net__SockAddr__Inet6_scope_id); |
787
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::flowinfo", XS_Net__SockAddr__Inet6_flowinfo); |
788
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Inet6::addr", XS_Net__SockAddr__Inet6_addr); |
789
|
|
|
|
|
|
|
#if XSubPPtmpAAAB |
790
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Unix::new", XS_Net__SockAddr__Unix_new); |
791
|
5
|
|
|
|
|
|
newXS_deffile("Net::SockAddr::Unix::path", XS_Net__SockAddr__Unix_path); |
792
|
|
|
|
|
|
|
#endif |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
/* Initialisation Section */ |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
#line 17 "SockAddr.xs" |
797
|
|
|
|
|
|
|
{ |
798
|
|
|
|
|
|
|
Stash me("Net::SockAddr"); |
799
|
|
|
|
|
|
|
Stash("Net::SockAddr::Inet4", GV_ADD).inherit(me); |
800
|
|
|
|
|
|
|
Stash("Net::SockAddr::Inet6", GV_ADD).inherit(me); |
801
|
|
|
|
|
|
|
Stash("Net::SockAddr::Unix", GV_ADD).inherit(me); |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
create_constants(me, { |
804
|
|
|
|
|
|
|
{"AF_UNSPEC", AF_UNSPEC}, |
805
|
|
|
|
|
|
|
{"AF_INET", AF_INET }, |
806
|
|
|
|
|
|
|
{"AF_INET6", AF_INET6 }, |
807
|
|
|
|
|
|
|
{"AF_UNIX", AF_UNIX }, |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
{"INADDR_ANY", Simple(addr2sv(SockAddr::Inet4::addr_any)) }, |
810
|
|
|
|
|
|
|
{"INADDR_LOOPBACK", Simple(addr2sv(SockAddr::Inet4::addr_loopback)) }, |
811
|
|
|
|
|
|
|
{"INADDR_BROADCAST", Simple(addr2sv(SockAddr::Inet4::addr_broadcast)) }, |
812
|
|
|
|
|
|
|
{"INADDR_NONE", Simple(addr2sv(SockAddr::Inet4::addr_none)) }, |
813
|
|
|
|
|
|
|
{"IN6ADDR_ANY", Simple(addr2sv(SockAddr::Inet6::addr_any)) }, |
814
|
|
|
|
|
|
|
{"IN6ADDR_LOOPBACK", Simple(addr2sv(SockAddr::Inet6::addr_loopback)) }, |
815
|
|
|
|
|
|
|
{"SOCKADDR_ANY", xs::out(SockAddr::Inet4::sockaddr_any) }, |
816
|
|
|
|
|
|
|
{"SOCKADDR_LOOPBACK", xs::out(SockAddr::Inet4::sockaddr_loopback) }, |
817
|
|
|
|
|
|
|
{"SOCKADDR6_ANY", xs::out(SockAddr::Inet6::sockaddr_any) }, |
818
|
|
|
|
|
|
|
{"SOCKADDR6_LOOPBACK", xs::out(SockAddr::Inet6::sockaddr_loopback) } |
819
|
|
|
|
|
|
|
}); |
820
|
|
|
|
|
|
|
autoexport(me); |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
#if XSubPPtmpAAAA |
824
|
|
|
|
|
|
|
#endif |
825
|
|
|
|
|
|
|
#if XSubPPtmpAAAB |
826
|
|
|
|
|
|
|
#endif |
827
|
|
|
|
|
|
|
#line 828 "SockAddr_xsgen.cc" |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
/* End of Initialisation Section */ |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
832
|
|
|
|
|
|
|
# if PERL_VERSION_GE(5, 9, 0) |
833
|
|
|
|
|
|
|
if (PL_unitcheckav) |
834
|
|
|
|
|
|
|
call_list(PL_scopestack_ix, PL_unitcheckav); |
835
|
|
|
|
|
|
|
# endif |
836
|
|
|
|
|
|
|
XSRETURN_YES; |
837
|
|
|
|
|
|
|
#else |
838
|
5
|
|
|
|
|
|
Perl_xs_boot_epilog(aTHX_ ax); |
839
|
|
|
|
|
|
|
#endif |
840
|
10
|
50
|
|
|
|
|
}); } |
841
|
|
|
|
|
|
|
|