asterisk.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Asterisk -- A telephony toolkit for Linux.
  3. *
  4. * General Definitions for Asterisk top level program
  5. *
  6. * Copyright (C) 1999-2005, Mark Spencer
  7. *
  8. * Mark Spencer <markster@digium.com>
  9. *
  10. * This program is free software, distributed under the terms of
  11. * the GNU General Public License
  12. */
  13. /*! \file
  14. * \brief Asterisk main include file. File version handling, generic pbx functions.
  15. */
  16. #ifndef _ASTERISK_H
  17. #define _ASTERISK_H
  18. #define DEFAULT_LANGUAGE "en"
  19. #define AST_CONFIG_MAX_PATH 255
  20. #define setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
  21. #define sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
  22. /* provided in asterisk.c */
  23. extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
  24. extern char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH];
  25. extern char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH];
  26. extern char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
  27. extern char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
  28. extern char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
  29. extern char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
  30. extern char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
  31. extern char ast_config_AST_DB[AST_CONFIG_MAX_PATH];
  32. extern char ast_config_AST_KEY_DIR[AST_CONFIG_MAX_PATH];
  33. extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
  34. extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
  35. extern char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH];
  36. extern char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH];
  37. extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
  38. extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
  39. extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
  40. /* Provided by asterisk.c */
  41. int ast_set_priority(int);
  42. /* Provided by module.c */
  43. int load_modules(const int preload_only);
  44. /* Provided by pbx.c */
  45. int load_pbx(void);
  46. /* Provided by logger.c */
  47. int init_logger(void);
  48. void close_logger(void);
  49. /* Provided by frame.c */
  50. int init_framer(void);
  51. /* Provided by logger.c */
  52. int reload_logger(int);
  53. /* Provided by term.c */
  54. int term_init(void);
  55. /* Provided by db.c */
  56. int astdb_init(void);
  57. /* Provided by channel.c */
  58. void ast_channels_init(void);
  59. /* Provided by dnsmgr.c */
  60. int dnsmgr_init(void);
  61. void dnsmgr_start_refresh(void);
  62. void dnsmgr_reload(void);
  63. /*!
  64. * \brief Register the version of a source code file with the core.
  65. * \param file the source file name
  66. * \param version the version string (typically a CVS revision keyword string)
  67. * \return nothing
  68. *
  69. * This function should not be called directly, but instead the
  70. * ASTERISK_FILE_VERSION macro should be used to register a file with the core.
  71. */
  72. void ast_register_file_version(const char *file, const char *version);
  73. /*!
  74. * \brief Unregister a source code file from the core.
  75. * \param file the source file name
  76. * \return nothing
  77. *
  78. * This function should not be called directly, but instead the
  79. * ASTERISK_FILE_VERSION macro should be used to automatically unregister
  80. * the file when the module is unloaded.
  81. */
  82. void ast_unregister_file_version(const char *file);
  83. /*!
  84. * \brief Register/unregister a source code file with the core.
  85. * \param file the source file name
  86. * \param version the version string (typically a CVS revision keyword string)
  87. *
  88. * This macro will place a file-scope constructor and destructor into the
  89. * source of the module using it; this will cause the version of this file
  90. * to registered with the Asterisk core (and unregistered) at the appropriate
  91. * times.
  92. *
  93. * Example:
  94. *
  95. * \code
  96. * ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")
  97. * \endcode
  98. *
  99. * \note The dollar signs above have been protected with backslashes to keep
  100. * SVN from modifying them in this file; under normal circumstances they would
  101. * not be present and SVN would expand the Revision keyword into the file's
  102. * revision number.
  103. */
  104. #if defined(__GNUC__) && !defined(LOW_MEMORY)
  105. #define ASTERISK_FILE_VERSION(file, version) \
  106. static void __attribute__((constructor)) __register_file_version(void) \
  107. { \
  108. ast_register_file_version(file, version); \
  109. } \
  110. static void __attribute__((destructor)) __unregister_file_version(void) \
  111. { \
  112. ast_unregister_file_version(file); \
  113. }
  114. #elif !defined(LOW_MEMORY) /* ! __GNUC__ && ! LOW_MEMORY*/
  115. #define ASTERISK_FILE_VERSION(file, x) static const char __file_version[] = x;
  116. #else /* LOW_MEMORY */
  117. #define ASTERISK_FILE_VERSION(file, x)
  118. #endif /* __GNUC__ */
  119. #endif /* _ASTERISK_H */