mesh.h (266114) | mesh.h (276605) |
---|---|
1/* 2 * services/mesh.h - deal with mesh of query states and handle events for that. 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 339 unchanged lines hidden (view full) --- 348 * so that the next run of the query with this module is successful. 349 * o no init needed, attachment successful. 350 * 351 * @param qstate: the state to find mesh state, and that wants to receive 352 * the results from the new subquery. 353 * @param qinfo: what to query for (copied). 354 * @param qflags: what flags to use (RD / CD flag or not). 355 * @param prime: if it is a (stub) priming query. | 1/* 2 * services/mesh.h - deal with mesh of query states and handle events for that. 3 * 4 * Copyright (c) 2007, NLnet Labs. All rights reserved. 5 * 6 * This software is open source. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 339 unchanged lines hidden (view full) --- 348 * so that the next run of the query with this module is successful. 349 * o no init needed, attachment successful. 350 * 351 * @param qstate: the state to find mesh state, and that wants to receive 352 * the results from the new subquery. 353 * @param qinfo: what to query for (copied). 354 * @param qflags: what flags to use (RD / CD flag or not). 355 * @param prime: if it is a (stub) priming query. |
356 * @param valrec: if it is a validation recursion query (lookup of key, DS). |
|
356 * @param newq: If the new subquery needs initialisation, it is returned, 357 * otherwise NULL is returned. 358 * @return: false on error, true if success (and init may be needed). 359 */ 360int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo, | 357 * @param newq: If the new subquery needs initialisation, it is returned, 358 * otherwise NULL is returned. 359 * @return: false on error, true if success (and init may be needed). 360 */ 361int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo, |
361 uint16_t qflags, int prime, struct module_qstate** newq); | 362 uint16_t qflags, int prime, int valrec, struct module_qstate** newq); |
362 363/** 364 * Query state is done, send messages to reply entries. 365 * Encode messages using reply entry values and the querystate (with original 366 * qinfo), using given reply_info. 367 * Pass errcode != 0 if an error reply is needed. 368 * If no reply entries, nothing is done. 369 * Must be called before a module can module_finished or return module_error. --- 31 unchanged lines hidden (view full) --- 401 402/** 403 * Create and initialize a new mesh state and its query state 404 * Does not put the mesh state into rbtrees and so on. 405 * @param env: module environment to set. 406 * @param qinfo: query info that the mesh is for. 407 * @param qflags: flags for query (RD / CD flag). 408 * @param prime: if true, it is a priming query, set is_priming on mesh state. | 363 364/** 365 * Query state is done, send messages to reply entries. 366 * Encode messages using reply entry values and the querystate (with original 367 * qinfo), using given reply_info. 368 * Pass errcode != 0 if an error reply is needed. 369 * If no reply entries, nothing is done. 370 * Must be called before a module can module_finished or return module_error. --- 31 unchanged lines hidden (view full) --- 402 403/** 404 * Create and initialize a new mesh state and its query state 405 * Does not put the mesh state into rbtrees and so on. 406 * @param env: module environment to set. 407 * @param qinfo: query info that the mesh is for. 408 * @param qflags: flags for query (RD / CD flag). 409 * @param prime: if true, it is a priming query, set is_priming on mesh state. |
410 * @param valrec: if true, it is a validation recursion query, and sets 411 * is_valrec on the mesh state. |
|
409 * @return: new mesh state or NULL on allocation error. 410 */ 411struct mesh_state* mesh_state_create(struct module_env* env, | 412 * @return: new mesh state or NULL on allocation error. 413 */ 414struct mesh_state* mesh_state_create(struct module_env* env, |
412 struct query_info* qinfo, uint16_t qflags, int prime); | 415 struct query_info* qinfo, uint16_t qflags, int prime, int valrec); |
413 414/** 415 * Cleanup a mesh state and its query state. Does not do rbtree or 416 * reference cleanup. 417 * @param mstate: mesh state to cleanup. Its pointer may no longer be used 418 * afterwards. Cleanup rbtrees before calling this function. 419 */ 420void mesh_state_cleanup(struct mesh_state* mstate); --- 6 unchanged lines hidden (view full) --- 427 428/** 429 * Find a mesh state in the mesh area. Pass relevant flags. 430 * 431 * @param mesh: the mesh area to look in. 432 * @param qinfo: what query 433 * @param qflags: if RD / CD bit is set or not. 434 * @param prime: if it is a priming query. | 416 417/** 418 * Cleanup a mesh state and its query state. Does not do rbtree or 419 * reference cleanup. 420 * @param mstate: mesh state to cleanup. Its pointer may no longer be used 421 * afterwards. Cleanup rbtrees before calling this function. 422 */ 423void mesh_state_cleanup(struct mesh_state* mstate); --- 6 unchanged lines hidden (view full) --- 430 431/** 432 * Find a mesh state in the mesh area. Pass relevant flags. 433 * 434 * @param mesh: the mesh area to look in. 435 * @param qinfo: what query 436 * @param qflags: if RD / CD bit is set or not. 437 * @param prime: if it is a priming query. |
438 * @param valrec: if it is a validation-recursion query. |
|
435 * @return: mesh state or NULL if not found. 436 */ 437struct mesh_state* mesh_area_find(struct mesh_area* mesh, | 439 * @return: mesh state or NULL if not found. 440 */ 441struct mesh_state* mesh_area_find(struct mesh_area* mesh, |
438 struct query_info* qinfo, uint16_t qflags, int prime); | 442 struct query_info* qinfo, uint16_t qflags, int prime, int valrec); |
439 440/** 441 * Setup attachment super/sub relation between super and sub mesh state. 442 * The relation must not be present when calling the function. 443 * Does not update stat items in mesh_area. 444 * @param super: super state. 445 * @param sub: sub state. 446 * @return: 0 on alloc error. --- 71 unchanged lines hidden (view full) --- 518/** 519 * Find cycle; see if the given mesh is in the targets sub, or sub-sub, ... 520 * trees. 521 * If the sub-sub structure is too large, it returns 'a cycle'=2. 522 * @param qstate: given mesh querystate. 523 * @param qinfo: query info for dependency. 524 * @param flags: query flags of dependency. 525 * @param prime: if dependency is a priming query or not. | 443 444/** 445 * Setup attachment super/sub relation between super and sub mesh state. 446 * The relation must not be present when calling the function. 447 * Does not update stat items in mesh_area. 448 * @param super: super state. 449 * @param sub: sub state. 450 * @return: 0 on alloc error. --- 71 unchanged lines hidden (view full) --- 522/** 523 * Find cycle; see if the given mesh is in the targets sub, or sub-sub, ... 524 * trees. 525 * If the sub-sub structure is too large, it returns 'a cycle'=2. 526 * @param qstate: given mesh querystate. 527 * @param qinfo: query info for dependency. 528 * @param flags: query flags of dependency. 529 * @param prime: if dependency is a priming query or not. |
530 * @param valrec: if it is a validation recursion query (lookup of key, DS). |
|
526 * @return true if the name,type,class exists and the given qstate mesh exists 527 * as a dependency of that name. Thus if qstate becomes dependent on 528 * name,type,class then a cycle is created, this is return value 1. 529 * Too large to search is value 2 (also true). 530 */ 531int mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo, | 531 * @return true if the name,type,class exists and the given qstate mesh exists 532 * as a dependency of that name. Thus if qstate becomes dependent on 533 * name,type,class then a cycle is created, this is return value 1. 534 * Too large to search is value 2 (also true). 535 */ 536int mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo, |
532 uint16_t flags, int prime); | 537 uint16_t flags, int prime, int valrec); |
533 534/** compare two mesh_states */ 535int mesh_state_compare(const void* ap, const void* bp); 536 537/** compare two mesh references */ 538int mesh_state_ref_compare(const void* ap, const void* bp); 539 540/** --- 32 unchanged lines hidden --- | 538 539/** compare two mesh_states */ 540int mesh_state_compare(const void* ap, const void* bp); 541 542/** compare two mesh references */ 543int mesh_state_ref_compare(const void* ap, const void* bp); 544 545/** --- 32 unchanged lines hidden --- |