allquestions.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * \file allquestions.c
  3. *
  4. * \brief Quetions controller.
  5. *
  6. * Implements procedures for addign and removing questions from the global \ref
  7. * questions variable.
  8. */
  9. #include "config.h"
  10. #include <assert.h>
  11. #include <string.h>
  12. #include <bsd/sys/queue.h>
  13. #include <openssl/ssl.h>
  14. #include <mpi.h>
  15. #include "qa/questions/questions.h"
  16. void QA_library_init(void)
  17. {
  18. /* Initialize SSL Library by registering algorithms. */
  19. SSL_library_init();
  20. SSL_load_error_strings();
  21. #ifdef HAVE_OPENMPI
  22. /* OpenMPI initialization */
  23. MPI_Init(0 , NULL);
  24. #endif
  25. }
  26. /**
  27. * \brief Select a single question to be used.
  28. *
  29. */
  30. void select_question(const char *sq)
  31. {
  32. qa_question_t *q, *tmpq;
  33. select_all_questions();
  34. assert(questions.lh_first);
  35. LIST_FOREACH_SAFE(q, &questions, qs, tmpq)
  36. if (strcmp(q->name, sq))
  37. LIST_REMOVE(q, qs);
  38. }
  39. /**
  40. * \brief Puts registered questions into \ref questions.
  41. *
  42. * Disposes all registered questions into a global linked list, so that future
  43. * procedures can iterate over all possible tests.
  44. */
  45. void select_all_questions(void)
  46. {
  47. LIST_INIT(&questions);
  48. REGISTER_QUESTION(ExampleQuestion);
  49. REGISTER_QUESTION(WienerQuestion);
  50. REGISTER_QUESTION(PollardQuestion);
  51. REGISTER_QUESTION(FermatQuestion);
  52. REGISTER_QUESTION(MetadataQuestion);
  53. REGISTER_QUESTION(PollardRhoQuestion);
  54. REGISTER_QUESTION(WilliamsQuestion);
  55. REGISTER_QUESTION(DixonQuestion);
  56. REGISTER_QUESTION(PollardBrentRhoQuestion);
  57. }