On 15 Apr 2008 01:34:23 -0000, <[EMAIL PROTECTED]> wrote: > > > > am developing a project in which we have SNMP agent and SNMP manager. > We have manager in JAVA Applet.. When we enter some IP address and Mask > in Applet we want that it should create a packet and that IP-address should be > entered into /etc/host.allow file.
Where is the /etc/hosts.allow file? On the same system as the SNMP manager? Or on the same system as the SNMP agent? If it's on the same system as the manager, then you'll need to tweak the code of the manager application to update the hosts.allow file. This isn't really anything to do with SNMP at all (apart from being embedded within an SNMP application). If the file is on the same system as the SNMP agent, then you'll need to develop a MIB to allow you to do this. Have a good think - not just about what operations you might want to perform (adding entries, deleting entries, maybe even modifying entries). But also think about what information you might want to *retrieve* about that hosts' access control (/etc/hosts.allow, /etc/hosts.deny, what services are provided, etc). Once you're clear about what information you need to work with, then you can come up with a MIB design to describe this behaviour, and then the code for an agent module to implement this MIB. But you should always start with the management tasks, and what information these would require. > We also have snmpget and snmpset classes for creating get or set > packets. These packets access objects from MIBs. > > How to send a packet for that? > What is the packet format? > Which parameters are required. If you are using the Net-SNMP toolkit, then I'd suggest you look at the code for the 'snmpget' and 'snmpset' commands. This will show you how to build a request packet, and add the necessary varbinds to it. The admin settings are handling in the 'snmp_parse_args' routine (within the library code). But basically this involves filling in the approriate fields in the 'snmp_pdu' structure. Turning this PDU structure into an on-the-wire encoded request is handled by the Net-SNMP library. You don't need to worry about that. Dave ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
