view release on metacpan or search on metacpan
# see the manual pages on these functions for a description of what they do
void
nis_getnames(name)
nis_name name
PPCODE:
{
nis_name * names;
nis_name * names_first;
names_first = names = nis_getnames(name);
unsigned long ttl
char * type
unsigned char sep
char * path
SV * data
PPCODE:
{
nis_object object;
nis_result *res;
int pos;
SV **val;
SV * data
nis_name owner
nis_name group
unsigned long access
unsigned long ttl
PPCODE:
{
nis_result *table;
nis_result *res;
nis_object entry;
void
nis_remove_entry(name, flags)
nis_name name
unsigned long flags
PPCODE:
{
nis_result *res;
if ((res = nis_remove_entry(name, (nis_object *)NULL, flags)) ==
(nis_result *)NULL)
void
nis_modify_entry(name, data, flags)
nis_name name
SV * data
unsigned long flags
PPCODE:
{
nis_result *table;
nis_result *res, *lres;
nis_object *entry;
nis_name tname;
# list the names of the table entries
void
name_list(name)
nis_name name
PPCODE:
{
nis_result *res;
res = nis_list(name, 0, (int(*)())NULL, (void *)NULL);
void
entry_list(name, tableref)
nis_name name
SV * tableref
PPCODE:
{
nis_result *res;
res=nis_list(name, MASTER_ONLY, (int(*)())NULL, (void *)NULL);
}
void
nis_first_entry(name)
nis_name name
PPCODE:
{
nis_result *res;
u_int num;
res=nis_first_entry(name);
void
nis_next_entry(name, cookie)
nis_name name
netobj cookie
PPCODE:
{
nis_result *res;
u_int num;
res=nis_next_entry(name, &cookie);
# return information about an entry object
void
entry_info(path)
nis_name path
PPCODE:
{
nis_result *res;
res = lookup(path);
if (res == (nis_result *)NULL) XPUSHs(sv_newmortal());
# return information about a table object
void
table_info(path)
nis_name path
PPCODE:
{
nis_result *res;
res = lookup(path);
if (res == (nis_result *)NULL) XPUSHs(sv_newmortal());
void
entry_setinfo(name, data)
nis_name name
SV * data
PPCODE:
{
nis_result *res, *res2;
res = nis_list(name, MASTER_ONLY, (int(*)())NULL, (void *)NULL);
if (res == (nis_result *)NULL) XPUSHs(sv_newmortal());
void
table_setinfo(path, data)
nis_name path
SV * data
PPCODE:
{
nis_result *res, *res2;
SV **sv;
res = lookup(path);
# return the type of an object (e.g. TABLE, ENTRY, etc)
void
obj_type(path)
nis_name path
PPCODE:
{
nis_result *res;
res = lookup(path);
if (res == (nis_result *)NULL) XPUSHs(sv_newmortal());
view all matches for this distribution
view release on metacpan or search on metacpan
Wingraph.xs view on Meta::CPAN
char *s;
PREINIT:
SIZE sz;
int rv;
long x,y;
PPCODE:
rv=GetTextExtentPoint32(dc,s,strlen(s),&sz);
EXTEND(sp,2);
PUSHs(sv_2mortal(newSViv(sz.cx)));
PUSHs(sv_2mortal(newSViv(sz.cy)));
view all matches for this distribution
view release on metacpan or search on metacpan
void
_symbols ()
PREINIT:
int i;
PPCODE:
for (i = 0; i <= av_len(symbol_names); i++)
mXPUSHs(SvREFCNT_inc(*av_fetch(symbol_names, i, 0)));
BOOT:
symbol_names = newAV();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Neo4j/Bolt/Cxn.xs view on Meta::CPAN
void
reset_ (cxn_ref)
SV * cxn_ref
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
reset_(cxn_ref);
if (PL_markstack_ptr != temp) {
/* truly void, because dXSARGS not invoked */
PL_markstack_ptr = temp;
lib/Neo4j/Bolt/Cxn.xs view on Meta::CPAN
void
DESTROY (cxn_ref)
SV * cxn_ref
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
DESTROY(cxn_ref);
if (PL_markstack_ptr != temp) {
/* truly void, because dXSARGS not invoked */
PL_markstack_ptr = temp;
view all matches for this distribution
view release on metacpan or search on metacpan
RabbitMQ.xs view on Meta::CPAN
int durable = 0;
int exclusive = 0;
int auto_delete = 1;
amqp_table_t arguments = AMQP_EMPTY_TABLE;
amqp_bytes_t queuename_b = AMQP_EMPTY_BYTES;
PPCODE:
if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
if(options) {
int_from_hv(options, passive);
int_from_hv(options, durable);
int_from_hv(options, exclusive);
view all matches for this distribution
view release on metacpan or search on metacpan
open_queries(self)
adns_state self
PREINIT:
int n;
SV *wrapper;
PPCODE:
adns_forallqueries_begin(self);
for ( n = 0;
adns_forallqueries_next(self, (void**)(&wrapper));
n++)
XPUSHs(sv_2mortal(newSVsv(wrapper)));
PREINIT:
fd_set rfds, wfds, efds;
int maxfd = 0;
struct timeval *tv_mod = 0;
struct timeval tv_buf, now;
PPCODE:
FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&efds);
gettimeofday(&now, NULL);
adns_beforeselect(self,
&maxfd, &rfds, &wfds, &efds,
&tv_mod, &tv_buf, &now);
view all matches for this distribution
view release on metacpan or search on metacpan
RabbitMQ.xs view on Meta::CPAN
int exclusive = 0;
int auto_delete = 1;
amqp_table_t arguments = amqp_empty_table;
amqp_bytes_t queuename_b = amqp_empty_bytes;
amqp_queue_declare_ok_t *r = (amqp_queue_declare_ok_t*)NULL;
PPCODE:
assert_amqp_connected(conn);
if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
if(options) {
int_from_hv(options, passive);
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: DISABLE
AV *
decode_buffer(SV *this, SV *p)
PPCODE:
/* Plain bytestring required: no magic, no UTF-8, no nonsense */
if(!SvPOK(p))
croak("expected a string");
if(SvUTF8(p))
sv_utf8_downgrade(p, true);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/BART/XS.xs view on Meta::CPAN
void
lookup(self, ip_str)
SV *self
const char *ip_str
PPCODE:
bart_table_t *t = INT2PTR(bart_table_t*, SvIV(SvRV(self)));
uint8_t addr[16];
int is_ipv6 = parse_ip_str(aTHX_ ip_str, addr);
int found = 0;
void *val = bart_lookup(t, addr, is_ipv6, &found);
lib/Net/BART/XS.xs view on Meta::CPAN
void
get(self, prefix_str)
SV *self
const char *prefix_str
PPCODE:
bart_table_t *t = INT2PTR(bart_table_t*, SvIV(SvRV(self)));
uint8_t addr[16];
int addr_len, prefix_len;
int is_ipv6 = parse_prefix_str(aTHX_ prefix_str, addr, &addr_len, &prefix_len);
int found = 0;
lib/Net/BART/XS.xs view on Meta::CPAN
void
delete(self, prefix_str)
SV *self
const char *prefix_str
PPCODE:
bart_table_t *t = INT2PTR(bart_table_t*, SvIV(SvRV(self)));
uint8_t addr[16];
int addr_len, prefix_len;
int is_ipv6 = parse_prefix_str(aTHX_ prefix_str, addr, &addr_len, &prefix_len);
bart_node_t *root = is_ipv6 ? t->root6 : t->root4;
view all matches for this distribution
view release on metacpan or search on metacpan
RETVAL
void
file_type(THIS)
Net::BGPdump THIS
PPCODE:
switch (THIS->f->format) {
case 0:
// not opened
break;
case 1:
int ipv6
time_t lo_time
time_t hi_time
PREINIT:
BGPDUMP_ENTRY *entry;
PPCODE:
do {
entry = bgpdump_read_next(THIS);
if (entry == NULL)
continue;
if (lo_time > 0 && entry->time < lo_time)
int ipv6
time_t lo_time
time_t hi_time
PREINIT:
BGPDUMP_ENTRY *entry;
PPCODE:
do {
entry = bgpdump_read_next(THIS);
if (entry == NULL)
continue;
if (lo_time > 0 && entry->time < lo_time)
view all matches for this distribution
view release on metacpan or search on metacpan
rbldnsdAccessor.xs view on Meta::CPAN
char c
PREINIT:
SV * len;
PPCODE:
if (max >= RBLF_DLEN)
croak ("maximum transfer length exceeds internal buffer %d\n",RBLF_DLEN);
memset(abuf,c,RBLF_DLEN);
XPUSHs(sv_2mortal(newSViv(rblf_strncpy(abuf,src,max))));
rbldnsdAccessor.xs view on Meta::CPAN
PREINIT:
STRLEN len;
unsigned char * cp;
int rv;
PPCODE:
invalid_pkt = 1;
cp = (unsigned char *)SvPV(buffer,len);
bzero(&pkt,sizeof(struct dnspacket));
rv = rblf_safemcpy(pkt.p_buf, cp, (size_t)len,(pkt.p_buf + DNS_MAXPACKET));
if (rv < 0) {
rbldnsdAccessor.xs view on Meta::CPAN
void
rblf_next_answer()
PREINIT:
SV * rd;
PPCODE:
if (invalid_pkt) {
bail:
if (GIMME_V != G_ARRAY)
XSRETURN_UNDEF;
XSRETURN_EMPTY;
rbldnsdAccessor.xs view on Meta::CPAN
char * name
PREINIT:
int answers = 0;
PPCODE:
invalid_pkt = rblf_query(name,&pkt);
if (!invalid_pkt)
answers = (int)(pkt.p_buf[p_ancnt2]);
XPUSHs(sv_2mortal(newSViv(answers)));
rbldnsdAccessor.xs view on Meta::CPAN
rblf_dump_packet()
PREINIT:
STRLEN len;
PPCODE:
if (pkt.p_endp == NULL) {
bail:
if (GIMME != G_ARRAY)
XSRETURN_UNDEF;
XSRETURN_EMPTY;
view all matches for this distribution
view release on metacpan or search on metacpan
void
_close(sock)
int sock
PPCODE:
close(sock);
InOutStream
_perlfh(fd)
int fd
RETVAL
void
get_remote_devices(...)
PPCODE:
EXTEND(sp, 1);
char addr[19];
char name[248];
char *local_addr;
int len = 8; // 1.28 * len
void
sdp_search(addr, service, name)
char *addr
char *service
char *name
PPCODE:
EXTEND(sp, 1);
uuid_t svc_uuid;
bdaddr_t target;
sdp_list_t *response_list = NULL;
sdp_session_t *session = 0;
void
_accept(fd, proto)
int fd
char *proto
PPCODE:
EXTEND(sp, 2);
socklen_t addr_len;
int res;
if(strcasecmp(proto, "RFCOMM") == 0) {
char *proto
int port
char *service_id
char *name
char *desc
PPCODE:
uint8_t rfcomm_channel = 0;
uint16_t l2cap_port = 0;
const char *service_name = name;
const char *service_dsc = desc;
const char *service_prov = name;
void
_getpeername(fd, proto)
int fd
char *proto
PPCODE:
EXTEND(sp, 2);
if(strcasecmp(proto, "RFCOMM") == 0) {
struct sockaddr_rc rcaddr;
socklen_t len = sizeof(rcaddr);
if(getpeername(fd, (struct sockaddr *) &rcaddr, &len) == 0) {
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPE:
PREINIT:
dMY_CXT;
UV count;
cdp_llist_t *ports;
PPCODE:
MY_CXT.errors[0] = '\0';
if (GIMME_V == G_VOID) XSRETURN_EMPTY;
ports = cdp_get_ports(MY_CXT.errors);
if (!ports) croak(MY_CXT.errors);
PUSH_port_llist(ports);
addresses(self)
Net_CDP self
PROTOTYPE: $
PREINIT:
const cdp_llist_t *addresses;
PPCODE:
addresses = cdp_get_addresses(self);
PUSH_llist(addresses, "Net::CDP::Address");
int
_fd(self)
void
addresses(self, new_addresses=NULL)
Net_CDP_Packet self
Net_CDP_Address_List new_addresses
PROTOTYPE: $;$
PPCODE:
if (items > 1) {
if (self->addresses) cdp_llist_free(self->addresses);
self->addresses = new_addresses;
}
PUSH_llist(self->addresses, "Net::CDP::Address");
void
ip_prefixes(self, new_ip_prefixes=NULL)
Net_CDP_Packet self
Net_CDP_IPPrefix_List new_ip_prefixes
PROTOTYPE: $;$
PPCODE:
if (items > 1) {
if (self->ip_prefixes) cdp_llist_free(self->ip_prefixes);
self->ip_prefixes = new_ip_prefixes;
}
PUSH_llist(self->ip_prefixes, "Net::CDP::IPPrefix");
voice_vlan(self, new_voice_vlan=NULL, new_appliance_id=NULL)
Net_CDP_Packet self
U16_UNDEF new_voice_vlan
U8_UNDEF new_appliance_id
PROTOTYPE: $;$$
PPCODE:
if (items > 1) {
if (new_voice_vlan && (*new_voice_vlan < 1 || *new_voice_vlan > MAX_VLAN_ID))
croak("Invalid new_voice_vlan (must be between 1 and %u)", MAX_VLAN_ID);
if (new_appliance_id && *new_appliance_id < 1)
croak("Invalid new_appliance_id (must be between 1 and 255)");
voice_vlan_query(self, new_voice_vlan=NULL, new_appliance_id=NULL)
Net_CDP_Packet self
U16_UNDEF new_voice_vlan
U8_UNDEF new_appliance_id
PROTOTYPE: $;$$
PPCODE:
if (items > 1) {
if (new_voice_vlan && (*new_voice_vlan < 1 || *new_voice_vlan > MAX_VLAN_ID))
croak("Invalid new_voice_vlan (must be between 1 and %u)", MAX_VLAN_ID);
if (new_appliance_id && *new_appliance_id < 1)
croak("Invalid new_appliance_id (must be between 1 and 255)");
void
management_addresses(self, new_addresses=NULL)
Net_CDP_Packet self
Net_CDP_Address_List new_addresses
PROTOTYPE: $;$
PPCODE:
if (items > 1) {
if (self->mgmt_addresses) cdp_llist_free(self->mgmt_addresses);
self->mgmt_addresses = new_addresses;
CHECK_VERSION;
}
view all matches for this distribution
view release on metacpan or search on metacpan
const-xs.inc view on Meta::CPAN
/* 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:
view all matches for this distribution
view release on metacpan or search on metacpan
RETVAL
void
NETCUPS_getDestination( name )
char* name;
PPCODE:
cups_dest_t * destinations = NULL;
cups_dest_t * destination = NULL;
int count = 0;
SV* rv = NULL;
count = cupsGetDests( &destinations );
XPUSHs( rv );
XSRETURN( 1 );
void
NETCUPS_getDestinations()
PPCODE:
cups_dest_t * destinations = NULL;
int count = 0;
int loop = 0;
SV* rv = NULL;
count = cupsGetDests( &destinations );
void
NETCUPS_requestData( request, resource, filename )
ipp_t* request;
const char* resource;
const char* filename;
PPCODE:
http_t* http = NULL;
ipp_t* response = NULL;
const char* server = NULL;
SV* rv = NULL;
int port;
http_t *http; /* HTTP object */
ipp_t *request; /* IPP request object */
ipp_t *response; /* IPP response object */
ipp_attribute_t *attr; /* Current IPP attribute */
PPCODE:
SV* rv = NULL;
int count = 0;
cups_lang_t *language;
language = cupsLangDefault();
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
http_t *http; /* HTTP object */
ipp_t *request; /* IPP request object */
ipp_t *response; /* IPP response object */
ipp_attribute_t *attr; /* Current IPP attribute */
PPCODE:
SV* rv = NULL;
int count = 0;
cups_lang_t *language;
language = cupsLangDefault();
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
void
NETCUPS_deleteDestination( destination );
const char* destination;
PPCODE:
ipp_t *request;
http_t *http;
char uri[HTTP_MAX_URI];
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
const char* location;
const char* printer_info;
const char* ppd_name;
const char* device_uri;
PPCODE:
http_t *http = NULL; /* HTTP object */
ipp_t *request = NULL; /* IPP request object */
char uri[HTTP_MAX_URI]; /* Job URI */
http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
void
NETCUPS_getPPDFileName(ppdfilename);
const char* ppdfilename;
PPCODE:
http_t *http; /* HTTP object */
ipp_t *request; /* IPP request object */
ipp_t *response; /* IPP response object */
ipp_attribute_t *attr; /* Current IPP attribute */
int i = 0;
NETCUPS_getDeviceAttribute( device, attribute, attribute_type )
const char* device;
const char* attribute;
int attribute_type;
PPCODE:
http_t *http = NULL; /* HTTP object */
ipp_t *request = NULL; /* IPP request */
ipp_t *response = NULL; /* IPP response */
ipp_attribute_t *attr = NULL; /* IPP attribute */
SV* rv = NULL;
INIT:
int count = 0;
int loop = 0;
SV* rv = NULL;
cups_option_t* options = NULL;
PPCODE:
count = self->num_options;
options = self->options;
for( loop = 0; loop < count; loop++ )
{
void
NETCUPS_getJobs( dest, whose, scope )
const char* dest;
int whose;
int scope;
PPCODE:
int loop = 0;
int count = 0;
SV* rv = NULL;
cups_job_t* jobs = NULL;
count = cupsGetJobs( &jobs, dest, whose, scope );
void
NETCUPS_getAttributes( ipp )
ipp_t* ipp;
PPCODE:
SV* rv = NULL;
int count = 0;
ipp_attribute_t* attr = NULL;
for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp))
{
void
NETCUPS_getAttributeValue( ipp, name )
ipp_t* ipp;
const char* name;
PPCODE:
SV* rv = NULL;
int count = 0;
ipp_attribute_t* attr = NULL;
for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp))
{
OUTPUT:
RETVAL
void
NETCUPS_newIPP()
PPCODE:
ipp_t * ipp = NULL;
SV* rv = NULL;
ipp = ippNew();
rv = sv_newmortal();
sv_setref_pv( rv, "Net::CUPS::IPP", ipp );
XSRETURN( 1 );
void
NETCUPS_newIPPRequest( op )
ipp_op_t op;
PPCODE:
ipp_t * ipp = NULL;
SV* rv = NULL;
ipp = ippNewRequest( op );
rv = sv_newmortal();
sv_setref_pv( rv, "Net::CUPS::IPP", ipp );
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: ENABLE
void
xs2p_gvars()
PPCODE:
EXTEND(SP,4);
PUSHs(sv_2mortal(newSVuv(now)));
PUSHs(sv_2mortal(newSVuv(start)));
PUSHs(sv_2mortal(newSVnv(rate)));
PUSHs(sv_2mortal(newSVnv(bw)));
int vector
PREINIT:
unsigned char * buf;
STRLEN len;
int dnslen, listenlen;
PPCODE:
switch(vector)
{
case SEND_dns :
if (av_len(dnsrequest) < 0) {
dnsRflag = 0;
HV * hp;
INIT:
if (SvTYPE(SvRV(hpp)) != SVt_PVHV)
croak("hp is not a hash REF");
hp = (HV *)SvRV(hpp);
PPCODE:
if (ix == 1) {
XPUSHs(sv_2mortal(newSVuv(fetch_uv(hp,key))));
XSRETURN(1);
} else
inc_sv(hp,key);
view all matches for this distribution
view release on metacpan or search on metacpan
Curl_Easy.xsh view on Meta::CPAN
const char *sclass
SV *base
PREINIT:
perl_curl_easy_t *easy;
HV *stash;
PPCODE:
if ( ! SvOK( base ) || ! SvROK( base ) )
croak( "object base must be a valid reference\n" );
easy = perl_curl_easy_new();
perl_curl_easy_preset( easy );
Curl_Easy.xsh view on Meta::CPAN
PREINIT:
perl_curl_easy_t *clone;
const char *sclass;
perl_curl_easy_callback_code_t i;
HV *stash;
PPCODE:
if ( ! SvOK( base ) || ! SvROK( base ) )
croak( "object base must be a valid reference\n" );
sclass = sv_reftype( SvRV( ST(0) ), TRUE );
clone = perl_curl_easy_duphandle( easy );
view all matches for this distribution
view release on metacpan or search on metacpan
OUTPUT:
RETVAL
void
_get_result(Net_DNS_Native *self, int fd)
PPCODE:
pthread_mutex_lock(&self->mutex);
DNS_result *res = bstree_get(self->fd_map, fd);
bstree_del(self->fd_map, fd);
pthread_mutex_unlock(&self->mutex);
free(res->arg);
free(res);
void
_timedout(Net_DNS_Native *self, int fd)
PPCODE:
char unknown = 0;
pthread_mutex_lock(&self->mutex);
if (bstree_get(self->fd_map, fd) == NULL) {
unknown = 1;
queue_destroy(self->tout_queue);
Safefree(self);
void
pack_sockaddr_in6(int port, SV *sv_address)
PPCODE:
STRLEN len;
char *address = SvPV(sv_address, len);
if (len != 16)
croak("address length is %lu should be 16", len);
XPUSHs(sv_2mortal(newSVpvn((char*) addr, sizeof(struct sockaddr_in6))));
void
unpack_sockaddr_in6(SV *sv_addr)
PPCODE:
STRLEN len;
char *addr = SvPV(sv_addr, len);
if (len != sizeof(struct sockaddr_in6))
croak("address length is %lu should be %lu", len, sizeof(struct sockaddr_in6));
view all matches for this distribution
view release on metacpan or search on metacpan
const-xs.inc view on Meta::CPAN
/* 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:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
SV **aptrs;
STRLEN len, size, bsize;
u_char **lastdnptr, **aoff;
u_char * exp_dn, * msg, * comp_dn;
int i, v, dnsize;
PPCODE:
if (! SvROK(buffer) || ! SvROK(name))
XSRETURN_EMPTY;
# see: perlapi on 'svtype' and /usr/lib/perl5/i386-linux/CORE/sv.h
SV * header
PROTOTYPE: $
PREINIT:
STRLEN len;
MY_HEADER * hp;
PPCODE:
if (! SvROK(header))
XSRETURN_EMPTY;
hp = (MY_HEADER *)SvPV(SvRV(header),len);
EXTEND(SP, 16);
PROTOTYPE: $
PREINIT:
u_char bmask[] = {128,64,32,16,8,4,2,1};
unsigned int i, hi, lo, tens[] = {1000,100,10,1, 1000,100,10,1};
char out[15];
PPCODE:
hi = lo = 0;
for(i=0;i<4;i++) {
if (ch & bmask[i])
hi += tens[i];
}
PROTOTYPE: $$$
PREINIT:
STRLEN size;
unsigned char * cp;
SV * out;
PPCODE:
if (!SvROK(buffer)) /* not a pointer */
XSRETURN_EMPTY;
cp = (u_char *)(SvPV(SvRV(buffer),size) + off);
Net::DNS::ToolKit::get32 = 1
PREINIT:
SV * out;
STRLEN size;
u_char * cp;
PPCODE:
if (GIMME_V == G_VOID)
XSRETURN_UNDEF; /* punt, nothing to return */
if (!SvROK(buffer)) {
bail:
unsigned int off
PREINIT:
SV * netaddr;
STRLEN size;
u_char * cp, out[NS_INADDRSZ];
PPCODE:
if (GIMME_V == G_VOID)
XSRETURN_UNDEF; /* punt, nothing to return */
if (!SvROK(buffer)) {
bail:
unsigned int off
PREINIT:
SV * ipv6addr;
STRLEN size;
u_char * cp, out[NS_IN6ADDRSZ];
PPCODE:
if (GIMME_V == G_VOID)
XSRETURN_UNDEF; /* punt, nothing to return */
if (!SvROK(buffer)) {
bail:
void
gettimeofday()
PREINIT:
SV * tmp; /* older perl does not know about newSVuv */
PPCODE:
if (gettimeofday(&tv,NULL)) { /* any error */
if (GIMME_V == G_ARRAY)
XSRETURN_EMPTY;
else
XSRETURN_UNDEF;
}
XSRETURN(1);
void
get_default()
PPCODE:
mysin();
XPUSHs(sv_2mortal(newSVpvn((char *)&mysa.sin_addr, NS_INADDRSZ)));
XSRETURN(1);
void
get_path()
PREINIT:
SV * out;
PPCODE:
if (path == NULL)
XSRETURN_UNDEF;
out = sv_newmortal();
sv_setpvn(out, path, (STRLEN)pathz);
XPUSHs(out);
void
lastchance()
PREINIT:
int i, nscount;
u_char * netptr;
PPCODE:
if ((nscount = lchance()) < 1) {
if (GIMME_V != G_ARRAY)
XSRETURN_UNDEF;
else
XSRETURN_EMPTY;
view all matches for this distribution
view release on metacpan or search on metacpan
char *host
INIT:
int res;
struct sigevent sev;
struct gaicb *gptr = &gcb;
PPCODE:
if (count) {
XPUSHs(sv_2mortal(newSViv(0)));
XPUSHs(sv_2mortal(newSVpv("Please call retrieve()", 0)));
}
else {
void
retrieve()
INIT:
int res;
char host[NI_MAXHOST];
PPCODE:
if (0 == count) {
XPUSHs(sv_2mortal(newSViv(0)));
XPUSHs(sv_2mortal(newSVpv("Please call lookup()", 0)));
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
my $END = "!End!\n\n"; # "impossible" keyword (multiple newline)
# Match an XS keyword
$BLOCK_re= '\s*(' . join('|', qw(
REQUIRE BOOT CASE PREINIT INPUT INIT CODE PPCODE OUTPUT
CLEANUP ALIAS ATTRS PROTOTYPES PROTOTYPE VERSIONCHECK INCLUDE
SCOPE INTERFACE INTERFACE_MACRO C_ARGS POSTCALL OVERLOAD FALLBACK
)) . "|$END)\\s*:";
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
s/^/&/ if $in_out{$_};
}
$func_args = join(", ", @func_args);
@args_match{@args} = @args_num;
$PPCODE = grep(/^\s*PPCODE\s*:/, @line);
$CODE = grep(/^\s*CODE\s*:/, @line);
# Detect CODE: blocks which use ST(n)= or XST_m*(n,v)
# to set explicit return values.
$EXPLICIT_RETURN = ($CODE &&
("@line" =~ /(\bST\s*\([^;]*=) | (\bXST_m\w+\s*\()/x ));
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
print Q(<<"EOF");
# PERL_UNUSED_VAR(cv); /* -W */
EOF
}
#gcc -Wall: if an xsub has PPCODE is used
#it is possible none of ST, XSRETURN or XSprePUSH macros are used
#hence `ax' (setup by dXSARGS) is unused
#XXX: could breakup the dXSARGS; into dSP;dMARK;dITEMS
#but such a move could break third-party extensions
print Q(<<"EOF") if $PPCODE;
# PERL_UNUSED_VAR(ax); /* -Wall */
EOF
print Q(<<"EOF") if $PPCODE;
# SP -= items;
EOF
# Now do a block of some sort.
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
}
print $deferred;
process_keyword("INIT|ALIAS|ATTRS|PROTOTYPE|INTERFACE_MACRO|INTERFACE|C_ARGS|OVERLOAD") ;
if (check_keyword("PPCODE")) {
print_section();
death ("PPCODE must be last thing") if @line;
print "\tLEAVE;\n" if $ScopeThisXSUB;
print "\tPUTBACK;\n\treturn;\n";
} elsif (check_keyword("CODE")) {
print_section() ;
} elsif (defined($class) and $func_name eq "DESTROY") {
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
process_keyword("CLEANUP|ALIAS|ATTRS|PROTOTYPE|OVERLOAD") ;
print Q(<<"EOF") if $ScopeThisXSUB;
# ]]
EOF
print Q(<<"EOF") if $ScopeThisXSUB and not $PPCODE;
# LEAVE;
EOF
# print function trailer
print Q(<<"EOF");
inc/ExtUtils/ParseXS.pm view on Meta::CPAN
# if (errbuf[0])
# Perl_croak(aTHX_ errbuf);
EOF
if ($xsreturn) {
print Q(<<"EOF") unless $PPCODE;
# XSRETURN($xsreturn);
EOF
} else {
print Q(<<"EOF") unless $PPCODE;
# XSRETURN_EMPTY;
EOF
}
print Q(<<"EOF");
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* 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:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
FreeDB.xs.linux view on Meta::CPAN
int i;
char id[30];
struct discdata data;
HV* hash = newHV();
AV* tracks = newAV();
PPCODE:
data = get_disc_id(dev);
for (i = 0; i < (data.num_of_trks); i++) {
av_push(tracks, newSVnv(data.track_offsets[i]));
}
view all matches for this distribution
view release on metacpan or search on metacpan
char ** results;
char ** res;
int i;
dTARGET;
SV *tmp;
PPCODE:
results = hesiod_resolve(context,name,type);
/* Handle an invalid query */
if ( ! results ) { XSRETURN_EMPTY; }
res = results;
i =0;
const char * name;
PREINIT:
struct passwd *pw;
dTARGET;
SV *tmp;
PPCODE:
pw = hesiod_getpwnam(context,name);
/* Handle errors by returning empty */
if ( ! pw ) { XSRETURN_EMPTY; }
/* Presumably, have a valid response */
tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_name);
uid_t uid;
PREINIT:
struct passwd *pw;
dTARGET;
SV *tmp;
PPCODE:
pw = hesiod_getpwuid(context,uid);
/* Handle errors by returning empty */
if ( ! pw ) { XSRETURN_EMPTY; }
/* Presumably, have a valid response */
tmp = sv_newmortal(); sv_setpv(tmp,pw->pw_name);
PREINIT:
struct servent *sent;
dTARGET;
SV *tmp;
int port;
PPCODE:
sent = hesiod_getservbyname(context,name, proto);
/* Handle errors by returning empty */
if ( ! sent ) { XSRETURN_EMPTY; }
/* Presumably, have a valid response */
/* servent struct is supposed to store port number in
char * user;
PREINIT:
struct hesiod_postoffice *po;
dTARGET;
SV * tmp;
PPCODE:
po = hesiod_getmailhost(context,user);
/* Handle errors by returning empty */
if ( ! po ) { XSRETURN_EMPTY; }
/* Presumably, have a valid response */
tmp= sv_newmortal(); sv_setpv(tmp,po->hesiod_po_type);
view all matches for this distribution
view release on metacpan or search on metacpan
PREINIT:
XS2_CTX* ctx;
SV* sv;
int i;
PPCODE:
STRLEN len;
char *sclass = SvPV(class, len);
#if PVER >= 5008008
Newx(ctx, 1, XS2_CTX);
#else
PREINIT:
XS2_CTX* ctx;
SV* sv;
int i;
PPCODE:
if (!SvROK(self)) {
XSRETURN_UNDEF;
} else {
ctx = INT2PTR(XS2_CTX*, SvIV(SvRV(self)));
}
PREINIT:
XS2_CTX* ctx;
SV* sv;
int i;
PPCODE:
if (!SvROK(self)) {
XSRETURN_UNDEF;
} else {
ctx = INT2PTR(XS2_CTX*, SvIV(SvRV(self)));
}
char *p;
int i;
SV* sv;
int func_call;
int res;
PPCODE:
if (items < 2) {
/* too few args */
XSRETURN_UNDEF;
}
if (!SvROK(ST(0))) {
PREINIT:
XS2_CTX* ctx;
AV* out;
I32 i;
PPCODE:
I32 gimme = GIMME_V;
I32 len = 0;
if (!SvROK(self)) {
XSRETURN_UNDEF;
SV* self
PREINIT:
XS2_CTX* ctx;
PPCODE:
if (!SvROK(self)) {
XSRETURN_UNDEF;
} else {
ctx = INT2PTR(XS2_CTX*, SvIV(SvRV(self)));
_clean(aTHX_ ctx);
SV* self
PREINIT:
XS2_CTX* ctx;
PPCODE:
if (!SvROK(self)) {
XSRETURN_UNDEF;
} else {
ctx = INT2PTR(XS2_CTX*, SvIV(SvRV(self)));
_clean(aTHX_ ctx);
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* 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:
view all matches for this distribution
view release on metacpan or search on metacpan
char *prefix
PREINIT:
char buf[MAX_IPV6_STR_LEN];
int len;
int res;
PPCODE:
res = NI_ip_splitprefix(prefix, buf, &len);
if (res) {
XPUSHs(sv_2mortal(newSVpv(buf, 0)));
XPUSHs(sv_2mortal(newSViv(len)));
}
PREINIT:
char *prefixes[MAX_PREFIXES];
int pcount;
int res;
int i;
PPCODE:
pcount = 0;
res = NI_ip_range_to_prefix(begin, end, ipversion, prefixes, &pcount);
if (!res) {
for (i = 0; i < pcount; i++) {
free(prefixes[i]);
int len
int version
PREINIT:
char buf[MAX_IPV6_RANGE_STR_LEN];
int res;
PPCODE:
res = NI_ip_prefix_to_range(ip, len, version, buf);
if (res) {
XPUSHs(sv_2mortal(newSVpv(ip, 0)));
XPUSHs(sv_2mortal(newSVpv(buf, 0)));
} else {
char *ip
PREINIT:
char buf1[MAX_IPV6_STR_LEN];
char buf2[MAX_IPV6_STR_LEN];
int res;
PPCODE:
buf1[0] = '\0';
buf2[0] = '\0';
res = NI_ip_normalize(ip, buf1, buf2);
if (res >= 1) {
XPUSHs(sv_2mortal(newSVpv(buf1, 0)));
PREINIT:
char *prefixes[MAX_PREFIXES];
int pcount;
int res;
int i;
PPCODE:
if (!sv_isa(self, "Net::IP::XS")) {
ST(0) = &PL_sv_undef;
} else {
pcount = 0;
res = NI_find_prefixes(self, prefixes, &pcount);
view all matches for this distribution
view release on metacpan or search on metacpan
inst/netsymbols.pl view on Meta::CPAN
print NFx qq|\t_NI_AF_TEST = __NI_AF_TEST
PREINIT:
SV * rv;
int n, i;
PPCODE:
if (ix >= $endv) {
croak("%s is not implemented on this architecture", GvNAME(CvGV(cv)));
}
rv = sv_2mortal(newSViv(ix));
n = sizeof(ni_af_sym_tab) / sizeof(ni_iff_t);
inst/netsymbols.pl view on Meta::CPAN
# add test element and complete
print NFx qq| PREINIT:
SV * rv;
int n, i;
PPCODE:
if (ix >= $endv) {
croak("%s is not implemented on this architecture", GvNAME(CvGV(cv)));
}
rv = sv_2mortal(newSVnv(bigsymvals[ix]));
n = sizeof(ni_sym_iff_tab) / sizeof(ni_iff_t);
view all matches for this distribution
view release on metacpan or search on metacpan
PREINIT:
plrd_kafka_t *krd;
rd_kafka_conf_t* conf;
rd_kafka_t* rk;
char errstr[ERRSTR_SIZE];
PPCODE:
Newxz(krd, 1, plrd_kafka_t);
conf = krd_parse_config(aTHX_ krd, params);
if (type == RD_KAFKA_PRODUCER) {
DEBUGF(krd->debug_xs, "Creating producer");
prd_init(krd, conf);
krd_queue_poll(rdk, timeout_ms = 0)
plrd_kafka_t *rdk
int timeout_ms
PREINIT:
rd_kafka_event_t* rke;
PPCODE:
rke = rd_kafka_queue_poll(rdk->queue, timeout_ms);
if (! rke) {
XSRETURN_EMPTY;
return;
}
void
krd_consumer_poll(rdk, timeout_ms = 0)
plrd_kafka_t *rdk
int timeout_ms
PPCODE:
rd_kafka_message_t *rd_msg = rd_kafka_consumer_poll( rdk->rk, timeout_ms );
if (! rd_msg) {
XSRETURN_EMPTY;
return;
void
krd_topic(rdk, topic)
plrd_kafka_t* rdk
char *topic
PPCODE:
rd_kafka_topic_t* rd_topic = rd_kafka_topic_new(rdk->rk, topic, NULL);
DEBUG2F(rdk->debug_xs, "Created Net::Kafka::Topic %s", rd_kafka_topic_name(rd_topic));
ST(0) = sv_newmortal();
sv_setref_pv( ST(0), "Net::Kafka::Topic", (void *)rd_topic );
XSRETURN(1);
int partition
long timeout_ms
PREINIT:
rd_kafka_resp_err_t err;
long low, high;
PPCODE:
err = rd_kafka_query_watermark_offsets(rdk->rk, topic, partition, &low, &high, timeout_ms);
if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
croak("Error querying watermark offsets: %s", rd_kafka_err2str(err));
}
EXTEND(SP, 2);
void
krdm_timestamp(rd_msg)
rd_kafka_message_t *rd_msg
PREINIT:
rd_kafka_timestamp_type_t tstype;
PPCODE:
long timestamp = rd_kafka_message_timestamp(rd_msg, &tstype);
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv(timestamp)));
PUSHs(sv_2mortal(newSViv(tstype)));
const void *value;
size_t value_len;
INPUT:
rd_kafka_headers_t* hdrs
const char *name
PPCODE:
err = rd_kafka_header_get_last(hdrs, name, &value, &value_len);
if (err == RD_KAFKA_RESP_ERR_NO_ERROR) {
PUSHs(sv_2mortal(newSVpvn(value, value_len)));
} else if (err == RD_KAFKA_RESP_ERR__NOENT) {
XSRETURN_UNDEF;
void
ktpl_get(rktpl, idx)
rd_kafka_topic_partition_list_t *rktpl
int idx
PPCODE:
if (!rktpl || idx < 0 || idx >= rktpl->cnt) {
return;
}
char* tn = rktpl->elems[idx].topic;
EXTEND(SP, 3);
rd_kafka_topic_partition_list_t *rktpl
char *topic
int partition
PREINIT:
rd_kafka_topic_partition_t *tp;
PPCODE:
tp = rd_kafka_topic_partition_list_find(rktpl, topic, partition);
if (tp == NULL) {
XSRETURN_EMPTY;
return;
}
view all matches for this distribution