GARP/GVRP Question

Sep 08, 2005 0 Replies

Hello Everybody,



I have been trying to understand the example code provided for GARP in



802.1d 1998 edition.

There are certain variables for which I am not able to understand their significance as regard to the code implementation. If someone has implemented/studied this kindly suggest if my understanding is correct.



There is a variable in Garp.h file



unsigned last_gid_used;



and it has been used at numerous places in the code.



I am giving excerpts from the example implementation in the standard



e.g



(1)in Gid.c under gid_create_gid as follows -



my_port->last_transmitted = application->last_gid_used; my_port->last_to_transmit = application->last_gid_used;



Here I am assume that they are trying to make sure that at the time when GID instance is created for this port it should be in default, i.e insure to this port/instance that there are transmissions pending


(2) It has been used in Destroy GID as well where I assume code is going through the whole array of GID instances and seeing if the instances which are registered and then destroying them



static void gid_destroy_gid(Gid *gid) { unsigned gid_index; for (gid_index = 0; gid_index application-



last_gid_used; gid_index++)

{ if (gid_registered_here(gid, gid_index)) gid->application->leave_indication_fn(gid->application, gid, gid_index); } sysfree(gid->machines); sysfree(gid); }


(3) static void gid_leaveall(Gid *my_port) { /*


  • only for shared media at present

*/ unsigned i; Garp *application; application = my_port->application; for (i = 0; i last_gid_used; i++) (void) gidtt_event(my_port, &my_port->machines[i], Gid_rcv_leaveempty); }

I am having problems undestanding the code at this point because I was assuming that last_gid_used is keeping track of the number og gid instances created for the application



But above code is used for sending leaveall messages to all the state machines of a port(Participant) How come we are using last_gid_used? Should not we use upper_limit of gid machines allowed per port



Kindly correct me my understanding??



Your help would be highly appreciated.



Thanks in advance. Sincerely, Jassy.


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required