Lines Matching refs:ctx
67 static int parse_config_file(struct hesiod_p *ctx, const char *filename);
68 static char ** get_txt_records(struct hesiod_p *ctx, int class,
78 struct hesiod_p *ctx; in hesiod_init() local
82 ctx = malloc(sizeof(struct hesiod_p)); in hesiod_init()
83 if (ctx == 0) in hesiod_init()
86 ctx->LHS = NULL; in hesiod_init()
87 ctx->RHS = NULL; in hesiod_init()
89 ctx->classes[0] = C_IN; in hesiod_init()
90 ctx->classes[1] = C_HS; in hesiod_init()
95 if (parse_config_file(ctx, configname) < 0) { in hesiod_init()
103 free(ctx->RHS); in hesiod_init()
104 ctx->RHS = malloc(strlen(cp)+2); in hesiod_init()
105 if (!ctx->RHS) in hesiod_init()
108 strcpy(ctx->RHS, cp); in hesiod_init()
110 ctx->RHS[0] = '.'; in hesiod_init()
111 strcpy(ctx->RHS + 1, cp); in hesiod_init()
119 if (!ctx->RHS) { in hesiod_init()
124 *context = ctx; in hesiod_init()
128 hesiod_end(ctx); in hesiod_init()
137 struct hesiod_p *ctx = (struct hesiod_p *) context; in hesiod_end() local
140 free(ctx->RHS); in hesiod_end()
141 free(ctx->LHS); in hesiod_end()
142 free(ctx); in hesiod_end()
152 struct hesiod_p *ctx = (struct hesiod_p *) context; in hesiod_to_bind() local
170 RHS = ctx->RHS; in hesiod_to_bind()
179 (ctx->LHS ? strlen(ctx->LHS) : 0) + 4)) == NULL) { in hesiod_to_bind()
189 if (ctx->LHS) { in hesiod_to_bind()
190 if (ctx->LHS[0] != '.') in hesiod_to_bind()
192 endp = __stpcpy (endp, ctx->LHS); in hesiod_to_bind()
210 struct hesiod_p *ctx = (struct hesiod_p *) context; in hesiod_resolve() local
217 retvec = get_txt_records(ctx, ctx->classes[0], bindname); in hesiod_resolve()
219 if (retvec == NULL && (errno == ENOENT || errno == ECONNREFUSED) && ctx->classes[1]) in hesiod_resolve()
220 retvec = get_txt_records(ctx, ctx->classes[1], bindname); in hesiod_resolve()
240 parse_config_file(struct hesiod_p *ctx, const char *filename) { in parse_config_file() argument
248 free(ctx->RHS); in parse_config_file()
249 free(ctx->LHS); in parse_config_file()
250 ctx->RHS = ctx->LHS = 0; in parse_config_file()
252 ctx->classes[0] = C_IN; in parse_config_file()
253 ctx->classes[1] = C_HS; in parse_config_file()
283 cpp = &ctx->LHS; in parse_config_file()
285 cpp = &ctx->RHS; in parse_config_file()
297 ctx->classes[n++] = C_IN; in parse_config_file()
299 ctx->classes[n++] = C_HS; in parse_config_file()
305 ctx->classes[0] = C_IN; in parse_config_file()
306 ctx->classes[1] = C_HS; in parse_config_file()
308 || ctx->classes[0] == ctx->classes[1]) in parse_config_file()
309 ctx->classes[1] = 0; in parse_config_file()
317 free(ctx->RHS); in parse_config_file()
318 free(ctx->LHS); in parse_config_file()
319 ctx->RHS = ctx->LHS = 0; in parse_config_file()
328 get_txt_records(struct hesiod_p *ctx, int class, const char *name) { in get_txt_records() argument