Deleted Added
full compact
33c33
< * $Begemot: bsnmp/lib/snmpagent.c,v 1.16 2003/12/03 09:55:58 hbb Exp $
---
> * $Begemot: bsnmp/lib/snmpagent.c,v 1.17 2004/04/13 14:58:46 novo Exp $
72,81d71
< * Structure to hold atfinish functions during SET processing.
< */
< struct finish {
< STAILQ_ENTRY(finish) link;
< snmp_set_finish_t func;
< void *arg;
< };
< STAILQ_HEAD(finish_list, finish);
<
< /*
87d76
< struct finish_list flist;
111d99
< STAILQ_INIT(&context->flist);
623a612,625
> void
> snmp_dep_finish(struct snmp_context *ctx)
> {
> struct context *context = (struct context *)ctx;
> struct depend *d;
>
> while ((d = TAILQ_FIRST(&context->dlist)) != NULL) {
> ctx->dep = &d->dep;
> (void)d->func(ctx, ctx->dep, SNMP_DEPOP_FINISH);
> TAILQ_REMOVE(&context->dlist, d, link);
> free(d);
> }
> }
>
633d634
< enum snmp_ret code;
637,638d637
< struct finish *f;
< struct depend *d;
644d642
< STAILQ_INIT(&context.flist);
742c740
< code = SNMP_RET_OK;
---
> context.ctx.code = SNMP_RET_OK;
814c812
< code = SNMP_RET_ERR;
---
> context.ctx.code = SNMP_RET_ERR;
839c837
< code = SNMP_RET_ERR;
---
> context.ctx.code = SNMP_RET_ERR;
871c869
< code = SNMP_RET_IGN;
---
> context.ctx.code = SNMP_RET_IGN;
878,881c876
< while ((d = TAILQ_FIRST(&context.dlist)) != NULL) {
< TAILQ_REMOVE(&context.dlist, d, link);
< free(d);
< }
---
> snmp_dep_finish(&context.ctx);
883,891d877
< /*
< * call finish function
< */
< while ((f = STAILQ_FIRST(&context.flist)) != NULL) {
< STAILQ_REMOVE_HEAD(&context.flist, link);
< (*f->func)(&context.ctx, code != SNMP_RET_OK, f->arg);
< free(f);
< }
<
893c879
< snmp_debug("set: returning %d", code);
---
> snmp_debug("set: returning %d", context.ctx.code);
895c881
< return (code);
---
> return (context.ctx.code);
944,963d929
< * Register a finish function.
< */
< int
< snmp_set_atfinish(struct snmp_context *ctx, snmp_set_finish_t func, void *arg)
< {
< struct context *context;
< struct finish *f;
<
< context = (struct context *)(void *)
< ((char *)ctx - offsetof(struct context, ctx));
< if ((f = malloc(sizeof(struct finish))) == NULL)
< return (-1);
< f->func = func;
< f->arg = arg;
< STAILQ_INSERT_TAIL(&context->flist, f, link);
<
< return (0);
< }
<
< /*