Re: related tables design

2008-01-23 Thread Xuan Pan
> On 23/01/2008, Xuan Pan <[EMAIL PROTECTED]> wrote: >> > What is the *full* code of: >> >- the module initialisation routine; >> >- the getFirst hook routine; >> >- the getNext hook routine >> > ? >> > Which line

Re: related tables design

2008-01-23 Thread Xuan Pan
> On 23/01/2008, Xuan Pan <[EMAIL PROTECTED]> wrote: >> > run a single "snmpgetnext -r 0 -t 6000 ..." query against this >> agent, >> > and single step through the routine until you hit this error. >> >What does the structure pointed to b

Re: related tables design

2008-01-23 Thread Xuan Pan
> On 23/01/2008, Xuan Pan <[EMAIL PROTECTED]> wrote: >> Finally I am stuck in front of an error, Internal error in type >> switching. >> It occurs: >> >> snmp_set_var_value(pIndex, (u_char *)& lpDhcpEntry->index, sizeof(int)); >&g

Re: related tables design

2008-01-23 Thread Xuan Pan
I appreciate your help as always :-) >> So I used the *dataContext to take the lpDhcpEntry pointer >> and *loopContext to take the other one. > But how is the iterator to know that's what you are doing?! > > You can't simply unilaterally decide to change the internal > operation of a librar

Re: related tables design

2008-01-23 Thread Xuan Pan
Thanks for your detailed explainations. >> getNextIpRangeContext(void ** loopContext, >>void **dataContext, >>netsnmp_variable_list * pIndex, >>netsnmp_iterator_info *pIterInfo) >> { >>L

Re: related tables design

2008-01-22 Thread Xuan Pan
Hi Dave the implementation is not as straightforward as I expected. I chose the data structure you proposed: > Or you could hold the IP Range Table data for each DHCP pool as part > of the DHCP settings data structure: > typedefstruct dhcpSetting { >int index; >char *name;

RE: [Fwd: Re: related tables design]

2008-01-18 Thread Xuan Pan
> I'm not sure what unsolved problem you refer to, but the chief reason for > putting the augmented index first is to allow a walk of > [table].[augmented index] to return all the rows which match the > augmented row. Understood. Thank you. > If you really are doing a table of DHCP ranges, are yo

Re: related tables design

2008-01-18 Thread Xuan Pan
>Or you could hold the IP Range Table data for each DHCP pool as part > of the DHCP settings data structure: >... I had this thought yesterday. Using the nested linked lists, there is no need to synchronize the primary index value from one list to the other. >dhcpSindex = *(pTableInfo->indexe

Re: [Fwd: Re: related tables design]

2008-01-18 Thread Xuan Pan
>>one for indexing itself, another one for referencing >> the row number in the DHCP settings table. > > Note that these should occur in the opposite order. > First the row number in the DHCP settings table, > and *then* the distinguishing index for the IP Range > table itself. > Thanks for th

Re: related tables design

2008-01-18 Thread Xuan Pan
> It's not a matter of which approach you prefer. > The question is more, which approach matches the > structure of your underlying data. Agree. > which implies that several rows in the IP range table > relate to a single pool in the settings table. > Is that correct? >> > dhcpIPRangeEntry OBJEC

RE: [Fwd: Re: related tables design]

2008-01-18 Thread Xuan Pan
>You misunderstand. The indexes for the IP Range Table must match those > of the DHCP Settings table, like so: > > [DHCP settings table] > index poolName serverIp rowStatus > 1 testPool a.a.a.a 1 > 2 testPool1 b.b.b.b 1 > 4

[Fwd: Re: related tables design]

2008-01-17 Thread Xuan Pan
I wonder whether I explained my question clearly in last post. I meant: If I use one index for two tables, is the index added in an incremental way for each new row in any of those two tables(as shown in my following example)? For example: The definition of rowStatus: #define NOTEXIST 0 #de

Re: related tables design

2008-01-17 Thread Xuan Pan
Thanks for your answer. I prefer the first solution. > If the two tables have the same indexing style (e.g. both indexed by > a single integer), then define one table in the normal manner: > > dhcpSettingsEntry OBJECT-TYPE > : > INDEX { dhcpSettingsIndex } > : > > and then define t

related tables design

2008-01-10 Thread Xuan Pan
Hi, If I have two tables, one of them references the other. For example, a table that represents DHCP settings including configurations like DHCP pool name, DHCP Server IP address and a DHCP client IP Range pool which has client start IP addresses, end IP addresses...How do I define those two tabl

Re: How to implement tables

2008-01-07 Thread Xuan Pan
Thanks Dave for being so helpful. I have got a working agent that can respond to queries on both Scalars and Tables. I chose iterator helper mainly because my data is stored externally. Then I realized I still need to copy the table data into a linked list locally into the memory so that the intera

Please disregard my first question...

2008-01-02 Thread Xuan Pan
Please disregard my first question... >1. I defined the table and each entry in the MIB file. I know I can use >snmpwalk to go through all entries in this table. But how to query data on >a specific row for example the data, DHCP server address, in the second >row, the second column. I think the

How to implement tables

2008-01-02 Thread Xuan Pan
Hi, I have been reading examples code and questions from others about how to implement tables but I still have some troubles. Thanks for helping me out on any of them: [Scenario] My table data is some configurations for example a DHCP pool. It consists of information like pool names, DHCP server

Re: [Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-21 Thread Xuan Pan
Everything seems to work now. My extension agent also works. It didn't work yesterday because my init function name didn't comply with the init_FILENAME rule. Thank you so much. Cheers /Pan > On 21/12/2007, Xuan Pan <[EMAIL PROTECTED]> wrote: >> > OK.

Re: [Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-21 Thread Xuan Pan
> OK. > Just to confirm - does >"snmpgetnext -v 1 -c public localhost ip" > > still return a noSuchName error? > This one seems to work. It returns IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2) and snmpget -v 1 -c public localhost ipForwarding.0 also works (but not the object ipForwardi

Re: [Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-21 Thread Xuan Pan
other service that is responding my request. /Pan > On 21/12/2007, Xuan Pan <[EMAIL PROTECTED]> wrote: >> To start up the daemon I use: >> /usr/local/sbin/snmpd -d -Le > > Can you please try using > > /usr/local/sbin/snmpd -f -Le > > instead. >

Re: [Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-21 Thread Xuan Pan
-- noSuchName error (possiblly as you said my configuration is wrong) 3. when snmpget objects from my module. After receiving the snmpget packets, the snmpd is terminated immediately(possibly something wrong with my implementation) Thanks for being so helpful. /Pan > On 20/12/2007, Xuan Pan <

Re: [Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-20 Thread Xuan Pan
correct (object values filed is filled with the returned data). /Pan > On 20/12/2007, Xuan Pan <[EMAIL PROTECTED]> wrote: >> ran snmpget -v1 -c public localhost ... > > That will definitely fail, since you haven't supplied > an object to retrieve. > > What does &g

[Fwd: Re: Q: how to create a simple agent deals with scalars]

2007-12-20 Thread Xuan Pan
Subject: Re: Q: how to create a simple agent deals with scalars From:"Xuan Pan" <[EMAIL PROTECTED]> Date:Thu, December 20, 2007 13:07 To: "Dave Shield" <[EMAIL PROTECTED]> Cc: net-snmp-users@lists.sourceforge.net ---

Re: Q: how to create a simple agent deals with scalars

2007-12-20 Thread Xuan Pan
hould write something in my initScalar() to switch from one request mode to another in order to handle different requests (set/get/get next...) and I didn't then how could snmpd tell which operation it should execute when it receives a corresponding request? /Pan > On 20/12/2007, Xua

Q: how to create a simple agent deals with scalars

2007-12-20 Thread Xuan Pan
Hi, I wrote an extension agent that deals with a single integer object defined in my MIB file by referencing the sample of scalar_int.c (http://www.net-snmp.org/dev/agent/scalar__int_8c-example.html) The problem is I keep getting the error, "(noSuchName) There is no such variable name in the MIB"

Re: question regarding how to use mib2c

2007-12-18 Thread Xuan Pan
, Integer, Counters. Please correct me if I am wrong) and two tables. Am I supposed to generate template code in multiple times and mix them together into one .h file and one .c file? /Pan >>>>>> "XP" == Xuan Pan <[EMAIL PROTECTED]> writes: > > XP> The

question regarding how to use mib2c

2007-12-18 Thread Xuan Pan
Hi, I am quite new to here as well as to the SNMP protocol. I am implementing a snmp agent and I've spent some time reading the online tutuorial. A question is I can understand this library has implemented useful helper features like mib2c to generate template code when converting MIB files, but i