Lines Matching refs:context
77 * Set context
79 struct context {
93 * Allocate a context
98 struct context *context;
100 if ((context = malloc(sizeof(*context))) == NULL)
103 memset(context, 0, sizeof(*context));
104 TAILQ_INIT(&context->dlist);
106 return (&context->ctx);
206 struct context context;
209 memset(&context, 0, sizeof(context));
210 context.ctx.data = data;
236 ret = (*tp->op)(&context.ctx, &resp->bindings[i],
327 do_getnext(struct context *context, const struct snmp_value *inb,
348 ret = (*tp->op)(&context->ctx, outb, tp->oid.len,
352 ret = (*tp->op)(&context->ctx, outb, tp->oid.len,
399 struct context context;
404 memset(&context, 0, sizeof(context));
405 context.ctx.data = data;
413 result = do_getnext(&context, &pdu->bindings[i],
448 struct context context;
456 memset(&context, 0, sizeof(context));
457 context.ctx.data = data;
470 result = do_getnext(&context, &pdu->bindings[i],
508 result = do_getnext(&context, &pdu->bindings[i],
511 result = do_getnext(&context,
552 rollback(struct context *context, struct snmp_pdu *pdu, u_int i)
560 np = context->node[i];
562 context->ctx.scratch = &context->scratch[i];
564 ret = (*np->op)(&context->ctx, b, np->oid.len, np->index,
584 struct context *context = (struct context *)ctx;
587 TAILQ_FOREACH(context->depend, &context->dlist, link) {
588 ctx->dep = &context->depend->dep;
594 ret = context->depend->func(ctx, ctx->dep, SNMP_DEPOP_COMMIT);
611 struct context *context = (struct context *)ctx;
617 while ((context->depend =
618 TAILQ_PREV(context->depend, depend_list, link)) != NULL) {
619 ctx->dep = &context->depend->dep;
625 ret = context->depend->func(ctx, ctx->dep, SNMP_DEPOP_ROLLBACK);
641 struct context *context = (struct context *)ctx;
644 while ((d = TAILQ_FIRST(&context->dlist)) != NULL) {
647 TAILQ_REMOVE(&context->dlist, d, link);
662 struct context context;
667 memset(&context, 0, sizeof(context));
668 TAILQ_INIT(&context.dlist);
669 context.ctx.data = data;
683 if ((np = context.node[i] = find_node(b, &except)) == NULL) {
762 context.ctx.code = SNMP_RET_OK;
770 np = context.node[i];
772 context.ctx.var_index = i + 1;
773 context.ctx.scratch = &context.scratch[i];
775 ret = (*np->op)(&context.ctx, b, np->oid.len, np->index,
831 rollback(&context, pdu, i);
834 context.ctx.code = SNMP_RET_ERR;
846 if ((ret = snmp_dep_commit(&context.ctx)) != SNMP_ERR_NOERROR) {
848 pdu->error_index = context.ctx.var_index;
850 if ((ret = snmp_dep_rollback(&context.ctx)) != SNMP_ERR_NOERROR) {
856 rollback(&context, pdu, i);
859 context.ctx.code = SNMP_RET_ERR;
874 np = context.node[i];
876 context.ctx.var_index = i + 1;
877 context.ctx.scratch = &context.scratch[i];
879 ret = (*np->op)(&context.ctx, b, np->oid.len, np->index,
891 context.ctx.code = SNMP_RET_IGN;
898 snmp_dep_finish(&context.ctx);
901 snmp_debug("set: returning %d", context.ctx.code);
903 return (context.ctx.code);
912 struct context *context;
915 context = (struct context *)(void *)
916 ((char *)ctx - offsetof(struct context, ctx));
922 TAILQ_FOREACH(d, &context->dlist, link)
946 TAILQ_INSERT_TAIL(&context->dlist, d, link);