/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <priv.h>
#include <glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <libhal.h>
#include "network-discovery.h"
#include "printer.h"
typedef struct {
char *parent;
char *community;
char *network;
static int
{
HAL_DEBUG(("nds_snmp_scan(0x%8.8x, %s, %s, %s)",
HAL_DEBUG(("NetworkDiscovery snmp scan initated"));
/* scan for devices */
}
} else
/* remove devices that haven't been seen since before this scan */
HAL_DEBUG(("NetworkDiscovery snmp scan completed"));
return (0);
}
static gboolean
{
return (FALSE);
}
return (TRUE);
}
static int
{
HAL_DEBUG(("NetworkDiscovery.EnablePrinterScanningViaSNMP(0x%8.8x, %s, %d, %s, %s)",
/* are we already discoverying network devices ? */
if (snmp_cb_data != NULL) {
}
/* setup for network device discovery */
/* prime the pump with an initial scan */
/* add a regular network scan */
}
return (0);
}
static int
{
if (snmp_cb_data != NULL)
snmp_cb_data = NULL;
return (0);
}
static int
char *network)
{
HAL_DEBUG(("NetworkDiscovery.ScanForPrintersViaSNMP(0x%8.8x, %s, %s, %s)",
}
static DBusHandlerResult
void *user_data)
{
DBUS_INTERFACE, "EnablePrinterScanningViaSNMP")) {
} else if (dbus_message_is_method_call(message,
DBUS_INTERFACE, "ScanForPrintersViaSNMP")) {
} else if (dbus_message_is_method_call(message,
DBUS_INTERFACE, "DisablePrinterScanningViaSNMP")) {
} else {
/* bypass not-handled messages */
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
if (dbus_error_is_set(&error))
HAL_WARNING(("Could not allocate memory for the DBus reply"));
return (FALSE);
}
HAL_WARNING(("Could not sent reply"));
}
return (DBUS_HANDLER_RESULT_HANDLED);
}
static int
{
char *interface_xml =
"<method name=\"EnablePrinterScanningViaSNMP\">\n"
" <arg name=\"interval\" direction=\"in\" type=\"i\"/>\n"
" <arg name=\"community\" direction=\"in\" type=\"s\"/>\n"
" <arg name=\"network\" direction=\"in\" type=\"s\"/>\n"
" <arg name=\"return_code\" direction=\"out\" type=\"i\"/>\n"
"</method>\n"
"<method name=\"DisablePrinterScanningViaSNMP\">\n"
" <arg name=\"return_code\" direction=\"out\" type=\"i\"/>\n"
"</method>\n"
"<method name=\"ScanForPrintersViaSNMP\">\n"
" <arg name=\"community\" direction=\"in\" type=\"s\"/>\n"
" <arg name=\"network\" direction=\"in\" type=\"s\"/>\n"
" <arg name=\"return_code\" direction=\"out\" type=\"i\"/>\n"
"</method>\n";
HAL_DEBUG(("nds_claim_interface(0x%8.8x, %s, 0x%8.8x): %s",
HAL_WARNING(("Could not get DBus connection"));
return (-1);
}
return (-1);
}
return (0);
}
static void
{
/*
* Start with the 'basic' privilege set and then remove any
* of the 'basic' privileges that will not be needed.
*/
return;
}
/* Clear privileges we will not need from the 'basic' set */
/* Set the permitted privilege set. */
return;
}
/* Clear the limit set. */
return;
}
return;
}
}
int
{
char *udi;
return (0);
}
setup_logger();
return (0);
}
return (0);
}
return (0);
}
/* NOTREACHED */
}