Skip to content

Commit

Permalink
Better documentation. There are functions whose description is good when
Browse files Browse the repository at this point in the history
reading source but whose documentation does not belong to progdocs.
  • Loading branch information
pavelmachek committed Jun 5, 2000
1 parent 22080a8 commit 4c5f93d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 29 deletions.
19 changes: 11 additions & 8 deletions filter/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* forced. Important thing about &f_val s is that they may be copied
* with simple =. That's fine for all currently defined types: strings
* are read-only (and therefore okay), paths are copied for each
* operation (okay too). */
* operation (okay too).
*/

#undef LOCAL_DEBUG

Expand Down Expand Up @@ -70,7 +71,7 @@ pm_path_compare(struct f_path_mask *m1, struct f_path_mask *m2)
}
}

/**
/*
* val_compare - compare two values, returns -1, 0, 1 on <, =, > and 999 on error
*/
int
Expand Down Expand Up @@ -105,7 +106,7 @@ val_compare(struct f_val v1, struct f_val v2)
}
}

/**
/*
* val_simple_in_range - check if @v1 ~ @v2 for everything except sets
*/
int
Expand Down Expand Up @@ -139,7 +140,7 @@ val_simple_in_range(struct f_val v1, struct f_val v2)
return CMP_ERROR;
}

/**
/*
* val_in_range - check if @v1 ~ @v2
*/
int
Expand Down Expand Up @@ -183,7 +184,7 @@ tree_print(struct f_tree *t)
debug( "] " );
}

/**
/*
* val_print - format filter value
*/
void
Expand Down Expand Up @@ -218,7 +219,7 @@ static struct ea_list **f_tmp_attrs;
static int f_flags;
static rta *f_rta_copy;

/**
/*
* rta_cow - prepare rta for modification by filter
*/
void
Expand Down Expand Up @@ -257,7 +258,7 @@ rta_cow(void)
* interpret
* @what: filter to interrpret
*
* Interrpret given tree of filter instructions. This is core function
* Interpret given tree of filter instructions. This is core function
* of filter system and does all the hard work.
*/
static struct f_val
Expand Down Expand Up @@ -681,7 +682,7 @@ interpret(struct f_inst *what)

#define A2_SAME if (f1->a2.i != f2->a2.i) return 0;

/**
/*
* i_same - function that does real comparing of instruction trees, you should call filter_same from outside
*/
int
Expand Down Expand Up @@ -765,8 +766,10 @@ i_same(struct f_inst *f1, struct f_inst *f2)
/**
* f_run - external entry point to filters
* @filter: pointer to filter to run
* @tmp_attrs: where to store newly generated temporary attributes
* @rte: pointer to pointer to rte being filtered. When route is modified, this is changed with rte_cow.
* @tmp_pool: all filter allocations go from this pool
* @flags: flags
*/
int
f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool, int flags)
Expand Down
4 changes: 2 additions & 2 deletions proto/rip/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define PACKETLEN(num) (num * sizeof(struct rip_block) + sizeof(struct rip_packet_heading))

/**
/*
* rip_incoming_authentication - check authentication of incomming packet and return 1 if there's problem.
*/
int
Expand Down Expand Up @@ -110,7 +110,7 @@ rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, stru
return 0;
}

/**
/*
* rip_outgoing_authentication - append authentication information to the packet.
* %num: number of rip_blocks already in packets. This function returns size of packet to send.
*/
Expand Down
54 changes: 35 additions & 19 deletions proto/rip/rip.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
*
* Rip is pretty simple protocol so half of this code is interface
* with core. We maintain our own linklist of &rip_entry - it serves
* as our small routing table. Within rip_tx(), this list is
* as our small routing table. Rip never adds into this linklist at
* packet reception; instead, it lets core know about data from packet,
* and waits for core to call our rip_rte_notify.
*
* Within rip_tx(), this list is
* walked, and packet is generated using rip_tx_prepare(). This gets
* tricky because we may need to send more than one packet to one
* destination. Struct &rip_connection is used to hold info such as how
Expand Down Expand Up @@ -65,7 +69,7 @@ static struct rip_interface *new_iface(struct proto *p, struct iface *new, unsig

#define P_NAME p->name

/**
/*
* DOC: Output processing
*
* This part is responsible for getting packets out to the network.
Expand All @@ -79,7 +83,7 @@ rip_tx_err( sock *s, int err )
log( L_ERR "%s: Unexpected error at rip transmit: %M", P_NAME, err );
}

/**
/*
* rip_tx_prepare:
* @e: rip entry that needs to be translated to form suitable for network
* @b: block to be filled
Expand Down Expand Up @@ -117,7 +121,7 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
return pos+1;
}

/**
/*
* rip_tx - send one rip packet to the network
*/
static void
Expand Down Expand Up @@ -195,7 +199,7 @@ rip_tx( sock *s )
return;
}

/**
/*
* rip_sendto - send whole routing table to selected destination
* @rif: interface to use. Notice that we lock interface so that at
* most one send to one interface is done.
Expand Down Expand Up @@ -246,7 +250,7 @@ find_interface(struct proto *p, struct iface *what)
return NULL;
}

/**
/*
* DOC: Input processing
*
* This part is responsible for any updates that come from network
Expand All @@ -262,13 +266,12 @@ rip_rte_update_if_better(rtable *tab, net *net, struct proto *p, rte *new)
rte_update(tab, net, p, new);
}

/**
/*
* advertise_entry - let main routing table know about our new entry
* @b: entry in network format
*
* This basically translates @b to format used by bird core and feeds
* bird core with this route. Notice that we do not store info anywhere
* in our data structures: we'll do that when core notifies us back.
* bird core with this route.
*/
static void
advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
Expand Down Expand Up @@ -334,7 +337,7 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
DBG( "done\n" );
}

/**
/*
* process_block - do some basic check and pass block to advertise_entry
*/
static void
Expand All @@ -360,7 +363,7 @@ process_block( struct proto *p, struct rip_block *block, ip_addr whotoldme )

#define BAD( x ) { log( L_REMOTE "%s: " x, P_NAME ); return 1; }

/**
/*
* rip_process_packet - this is main routine for incoming packets.
*/
static int
Expand Down Expand Up @@ -430,7 +433,7 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
return 0;
}

/**
/*
* rip_rx - Receive hook: do basic checks and pass packet to rip_process_packet
*/
static int
Expand Down Expand Up @@ -462,7 +465,7 @@ rip_rx(sock *s, int size)
return 1;
}

/**
/*
* DOC: Interface to bird core
*/

Expand All @@ -475,8 +478,16 @@ rip_dump_entry( struct rip_entry *e )
}

/**
* rip_timer - broadcast routing tables periodically (using rip_tx) and kill routes that are too old
* rip_timer
* @t: timer
*
* Broadcast routing tables periodically (using rip_tx) and kill
* routes that are too old. Rip keeps its own entries in main routing
* table linked by link list (functions rip_rte_insert and
* rip_rte_delete are responsible for that), walks this list in timer
* and in case entry is too old, it is discarded.
*/

static void
rip_timer(timer *t)
{
Expand Down Expand Up @@ -530,7 +541,7 @@ rip_timer(timer *t)
DBG( "RIP: tick tock done\n" );
}

/**
/*
* rip_start - initialize instance of rip
*/
static int
Expand Down Expand Up @@ -623,10 +634,15 @@ kill_iface(struct proto *p, struct rip_interface *i)
}

/**
* new_iface - actually create struct interface and start listening to it
* new_iface
* @p: myself
* @new: interface to be created or %NULL if we are creating magic
* socket. Magic socket is used for listening, and is also used for
* sending requested responses.
* @flags: interface flags
* @patt: pattern this interface matched, used for access to config options
*
* actually create struct interface and start listening to it
*/
static struct rip_interface *
new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_patt *patt )
Expand Down Expand Up @@ -810,7 +826,7 @@ rip_store_tmp_attrs(struct rte *rt, struct ea_list *attrs)
rt->u.rip.metric = ea_get_int(attrs, EA_RIP_METRIC, 1);
}

/**
/*
* rip_rt_notify - core tells us about new route (possibly our
* own), so store it into our data structures.
*/
Expand Down Expand Up @@ -882,7 +898,7 @@ rip_rte_better(struct rte *new, struct rte *old)
return 0;
}

/**
/*
* rip_rte_insert - we maintain linked list of "our" entries in main
* routing table, so that we can timeout them correctly. rip_timer
* walks the list.
Expand All @@ -897,7 +913,7 @@ rip_rte_insert(net *net, rte *rte)
add_head( &P->garbage, &rte->u.rip.garbage );
}

/**
/*
* rip_rte_remove - link list maintenance
*/
static void
Expand Down

0 comments on commit 4c5f93d

Please sign in to comment.