FreeBSD/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.c
/*
 * Dispatch a message to the correct module and delete it. More than one
 * module can get a message.
 */
Dispatch a message to the correct module and delete it. More than one
module can get a message.
Dispatch a message to the correct module and delete it . More than one module can get a message .
static void
csock_handle(struct ng_mesg *mesg, const char *path)
{
	struct msgreg *d, *d1;
	u_int id;
	int len;
	if (sscanf(path, "[%x]:%n", &id, &len) != 1 ||
	    (u_int)len != strlen(path)) {
		syslog(LOG_ERR, "cannot parse message path '%s'", path);
		id = 0;
	}
	d = SLIST_FIRST(&msgreg_list);
	while (d != NULL) {
		d1 = SLIST_NEXT(d, link);
		if (d->cookie == mesg->header.typecookie &&
		    (d->id == 0 || d->id == id || id == 0))
			(*d->func)(mesg, path, id, d->arg);
		d = d1;
	}
	free(mesg);
}
static void csock_handle ( struct ng_mesg * mesg , const char * path ) { struct msgreg * d , * d1 ; u_int id ; int len ; if ( sscanf ( path , " " , & id , & len ) != 1 || ( u_int ) len != strlen ( path ) ) { syslog ( LOG_ERR , " " , path ) ; id = 0 ; } d = SLIST_FIRST ( & msgreg_list ) ; while ( d != NULL ) { d1 = SLIST_NEXT ( d , link ) ; if ( d -> cookie == mesg -> header . typecookie && ( d -> id == 0 || d -> id == id || id == 0 ) ) ( * d -> func ) ( mesg , path , id , d -> arg ) ; d = d1 ; } free ( mesg ) ; }
Dispatch a message to the correct module and delete it.
Dispatch a message to the correct module and delete it .