/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of Server.xs. Do not edit this file, edit Server.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Server.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include <../../../../mdns-wrapper/mdnsd.h>
#include <../../../../mdns-wrapper/mdns_server.h>

#include "const-c.inc"

#line 22 "Server.c"

/* INCLUDE:  Including 'const-xs.inc' from 'Server.xs' */

XS(XS_Net__MDNS__Server_constant); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_constant)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::constant(sv)");
    SP -= items;
    {
#line 4 "const-xs.inc"
#ifdef dXSTARG
	dXSTARG; /* Faster if we have it.  */
#else
	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 */
#line 45 "Server.c"
	SV *	sv = ST(0);
	const char *	s = SvPV(sv, len);
#line 18 "const-xs.inc"
	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 Net::MDNS::Server macro", s));
          PUSHs(sv);
          break;
        case PERL_constant_NOTDEF:
          sv = sv_2mortal(newSVpvf(
	    "Your vendor has not defined Net::MDNS::Server macro %s, used", s));
          PUSHs(sv);
          break;
	/* Uncomment this if you need to return IVs
        case PERL_constant_ISIV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHi(iv);
          break; */
	/* Uncomment this if you need to return NOs
        case PERL_constant_ISNO:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_no);
          break; */
	/* Uncomment this if you need to return NVs
        case PERL_constant_ISNV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHn(nv);
          break; */
	/* Uncomment this if you need to return PVs
        case PERL_constant_ISPV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, strlen(pv));
          break; */
	/* Uncomment this if you need to return PVNs
        case PERL_constant_ISPVN:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHp(pv, iv);
          break; */
	/* Uncomment this if you need to return SVs
        case PERL_constant_ISSV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(sv);
          break; */
	/* Uncomment this if you need to return UNDEFs
        case PERL_constant_ISUNDEF:
          break; */
	/* Uncomment this if you need to return UVs
        case PERL_constant_ISUV:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHu((UV)iv);
          break; */
	/* Uncomment this if you need to return YESs
        case PERL_constant_ISYES:
          EXTEND(SP, 1);
          PUSHs(&PL_sv_undef);
          PUSHs(&PL_sv_yes);
          break; */
        default:
          sv = sv_2mortal(newSVpvf(
	    "Unexpected return type %d while processing Net::MDNS::Server macro %s, used",
               type, s));
          PUSHs(sv);
        }
#line 119 "Server.c"
	PUTBACK;
	return;
    }
}


/* INCLUDE: Returning to 'Server.xs' from 'const-xs.inc' */

XS(XS_Net__MDNS__Server_conflict_handler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_conflict_handler)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::conflict_handler()");
    {

	mdnss_conflict_handler();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__MDNS__Server_process_network_events); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_process_network_events)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::process_network_events()");
    {
	int	RETVAL;
	dXSTARG;

	RETVAL = mdnss_process_network_events();
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__MDNS__Server_start); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_start)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::start()");
    {
	int	RETVAL;
	dXSTARG;

	RETVAL = mdnss_start();
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__MDNS__Server_stop); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_stop)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::stop()");
    {

	mdnss_stop();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__MDNS__Server_add_service); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_add_service)
{
    dXSARGS;
    if (items != 5)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::add_service(hostname, host_ip, service_port, service, protocol)");
    {
	char *	hostname = (char *)SvPV_nolen(ST(0));
	char *	host_ip = (char *)SvPV_nolen(ST(1));
	char *	service = (char *)SvPV_nolen(ST(3));
	int	service_port = (int)SvIV(ST(2));
	char *	protocol = (char *)SvPV_nolen(ST(4));

	mdnss_add_service(hostname, host_ip, service_port, service, protocol);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__MDNS__Server_add_hostname); /* prototype to pass -Wmissing-prototypes */
XS(XS_Net__MDNS__Server_add_hostname)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::MDNS::Server::add_hostname(hostname, host_ip)");
    {
	char *	hostname = (char *)SvPV_nolen(ST(0));
	char *	host_ip = (char *)SvPV_nolen(ST(1));

	mdnss_add_hostname(hostname, host_ip);
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_Net__MDNS__Server); /* prototype to pass -Wmissing-prototypes */
XS(boot_Net__MDNS__Server)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("Net::MDNS::Server::constant", XS_Net__MDNS__Server_constant, file);
        newXS("Net::MDNS::Server::conflict_handler", XS_Net__MDNS__Server_conflict_handler, file);
        newXS("Net::MDNS::Server::process_network_events", XS_Net__MDNS__Server_process_network_events, file);
        newXS("Net::MDNS::Server::start", XS_Net__MDNS__Server_start, file);
        newXS("Net::MDNS::Server::stop", XS_Net__MDNS__Server_stop, file);
        newXS("Net::MDNS::Server::add_service", XS_Net__MDNS__Server_add_service, file);
        newXS("Net::MDNS::Server::add_hostname", XS_Net__MDNS__Server_add_hostname, file);
    XSRETURN_YES;
}

