Socket-More-Interface
view release on metacpan or search on metacpan
Interface.xs view on Meta::CPAN
getifaddrs()
INIT:
struct ifaddrs *a;
struct ifaddrs *next;
int ret;
HV* h;
UV count=0;
PPCODE:
ret=getifaddrs(&a);
if(ret<0){
switch(GIMME_V){
case G_SCALAR:
case G_VOID:
XSRETURN_UNDEF;
break;
case G_ARRAY:
XSRETURN_EMPTY;
Interface.xs view on Meta::CPAN
}
SV *
if_nametoindex(name)
SV *name;
INIT:
char *p;
unsigned int ret;
int len;
PPCODE:
if(SvOK(name)&&SvPOK(name)){
len=SvCUR(name);
p=SvGROW(name, len+1);
p[len]='\0';
ret=if_nametoindex(p);
mXPUSHs(newSVuv(ret));
XSRETURN(1);
}
Interface.xs view on Meta::CPAN
if_indextoname(index)
SV *index;
INIT:
SV *result=newSV(IF_NAMESIZE);
char *p=SvPVX(result);
char *ret;
PPCODE:
if(SvOK(index)){
ret=if_indextoname(SvUV(index), p);
if(ret == p){
SvPOK_on(result);
SvCUR_set(result, strlen(p));
mXPUSHs(result);
XSRETURN(1);
}
else {
Interface.xs view on Meta::CPAN
XSRETURN_UNDEF;
}
void
if_nameindex()
INIT:
UV count=0;
struct if_nameindex *results, *next;
PPCODE:
results=if_nameindex();
if(results ==NULL){
XSRETURN_UNDEF;
}
else {
next=results;
while((next->if_index !=0 )&&
const-xs.inc view on Meta::CPAN
dTARGET;
#endif
STRLEN len;
int type;
/* IV iv; Uncomment this if you need to return IVs */
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
type = constant(aTHX_ s, len);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
switch (type) {
case PERL_constant_NOTFOUND:
sv =
sv_2mortal(newSVpvf("%s is not a valid Socket::More::Interface macro", s));
PUSHs(sv);
break;
case PERL_constant_NOTDEF:
fallback/const-xs.inc view on Meta::CPAN
dTARGET;
#endif
STRLEN len;
int type;
/* IV iv; Uncomment this if you need to return IVs */
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
type = constant(aTHX_ s, len);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
switch (type) {
case PERL_constant_NOTFOUND:
sv =
sv_2mortal(newSVpvf("%s is not a valid Socket::More::Interface macro", s));
PUSHs(sv);
break;
case PERL_constant_NOTDEF:
( run in 0.770 second using v1.01-cache-2.11-cpan-5511b514fd6 )