summaryrefslogtreecommitdiff
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2008-06-10 12:48:50 +0000
committerRussell Bryant <russell@russellbryant.com>2008-06-10 12:48:50 +0000
commitf4a8062e9316b065b9b83632ca2046d43b990538 (patch)
tree6628d8e6cf74abb51f1267effcf152b32c7401ba /include/asterisk/utils.h
parent74932445b78e728c1b9819e3e5da4d0c82e72645 (diff)
Merge another change from team/russell/events ...
DUNDi uses a concept called the Entity ID for unique server identifiers. I have pulled out the handling of EIDs and made it something available to all of Asterisk. There is now a global Entity ID that can be used for other purposes as well, such as code providing distributed device state, which is why I did this. The global Entity ID is set automatically, just like it was done in DUNDi, but it can also be set in asterisk.conf. DUNDi will now use this global EID unless one is specified in dundi.conf. The current EID for the system can be seen in the "core show settings" CLI command. It is also available in the dialplan via the ENTITYID variable. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 074bc085d..0735babf1 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -671,4 +671,46 @@ static void force_inline _ast_assert(int condition, const char *condition_str,
#include "asterisk/strings.h"
+/*!
+ * \brief An Entity ID is essentially a MAC address, brief and unique
+ */
+struct ast_eid {
+ unsigned char eid[6];
+} __attribute__ ((__packed__));
+
+/*!
+ * \brief Global EID
+ *
+ * This is set in asterisk.conf, or determined automatically by taking the mac
+ * address of an Ethernet interface on the system.
+ */
+extern struct ast_eid g_eid;
+
+/*!
+ * \brief Fill in an ast_eid with the default eid of this machine
+ */
+void ast_set_default_eid(struct ast_eid *eid);
+
+/*!
+ * /brief Convert an EID to a string
+ */
+char *ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid);
+
+/*!
+ * \brief Convert a string into an EID
+ *
+ * This function expects an EID in the format:
+ * 00:11:22:33:44:55
+ *
+ * \return 0 success, non-zero failure
+ */
+int ast_str_to_eid(struct ast_eid *eid, const char *s);
+
+/*!
+ * \brief Compare two EIDs
+ *
+ * \return 0 if the two are the same, non-zero otherwise
+ */
+int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2);
+
#endif /* _ASTERISK_UTILS_H */