]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5657 --resolve fix mod_rayo build errors in CentOS 5
authorChris Rienzo <chris.rienzo@grasshopper.com>
Thu, 1 Aug 2013 18:37:28 +0000 (14:37 -0400)
committerChris Rienzo <chris.rienzo@grasshopper.com>
Thu, 1 Aug 2013 18:38:02 +0000 (14:38 -0400)
src/mod/event_handlers/mod_rayo/Makefile
src/mod/event_handlers/mod_rayo/iks_helpers.c
src/mod/event_handlers/mod_rayo/iks_helpers.h
src/mod/event_handlers/mod_rayo/rayo_elements.c [new file with mode: 0644]
src/mod/event_handlers/mod_rayo/rayo_elements.h

index d15ae1cbb1d64a19caa94135d5fe53c5eee037bb..6fccfdf318e989c45567324d46dfb2ee33c179bb 100644 (file)
@@ -10,6 +10,7 @@ LOCAL_OBJS= $(IKS_LA) \
        iks_helpers.o \
        nlsml.o \
        rayo_components.o \
+       rayo_elements.o \
        rayo_input_component.o \
        rayo_output_component.o \
        rayo_prompt_component.o \
@@ -21,6 +22,7 @@ LOCAL_SOURCES=        \
        iks_helpers.c \
        nlsml.c \
        rayo_components.c \
+       rayo_elements.c \
        rayo_input_component.c \
        rayo_output_component.c \
        rayo_prompt_component.c \
index 46fd1c4cea594a655a0d067ce7fe267daee55ce4..0b5616a1f37c64e7694132c4cdf34799b643bb36 100644 (file)
@@ -305,6 +305,93 @@ int value_matches(const char *value, const char *rule)
        return 0;
 }
 
+/**
+ * Validate boolean
+ * @param value
+ * @return SWTICH_TRUE if boolean
+ */
+int iks_attrib_is_bool(const char *value)
+{
+       if (value && *value && (!strcasecmp("true", value) || !strcasecmp("false", value))) {
+               return SWITCH_TRUE;
+       }
+       return SWITCH_FALSE;
+}
+
+/**
+ * Validate integer
+ * @param value
+ * @return SWTICH_TRUE if not negative
+ */
+int iks_attrib_is_not_negative(const char *value)
+{
+       if (value && *value && switch_is_number(value)) {
+               int value_i = atoi(value);
+               if (value_i >= 0) {
+                       return SWITCH_TRUE;
+               }
+       }
+       return SWITCH_FALSE;
+}
+
+/**
+ * Validate integer
+ * @param value
+ * @return SWTICH_TRUE if positive
+ */
+int iks_attrib_is_positive(const char *value)
+{
+       if (value && *value && switch_is_number(value)) {
+               int value_i = atoi(value);
+               if (value_i > 0) {
+                       return SWITCH_TRUE;
+               }
+       }
+       return SWITCH_FALSE;
+}
+
+/**
+ * Validate integer
+ * @param value
+ * @return SWTICH_TRUE if positive or -1
+ */
+int iks_attrib_is_positive_or_neg_one(const char *value)
+{
+       if (value && *value && switch_is_number(value)) {
+               int value_i = atoi(value);
+               if (value_i == -1 || value_i > 0) {
+                       return SWITCH_TRUE;
+               }
+       }
+       return SWITCH_FALSE;
+}
+
+/**
+ * Validate string
+ * @param value
+ * @return SWTICH_TRUE
+ */
+int iks_attrib_is_any(const char *value)
+{
+       return SWITCH_TRUE;
+}
+
+/**
+ * Validate decimal
+ * @param value
+ * @return SWTICH_TRUE if 0.0 <= x <= 1.0
+ */
+int iks_attrib_is_decimal_between_zero_and_one(const char *value)
+{
+       if (value && *value && switch_is_number(value)) {
+               double value_d = atof(value);
+               if (value_d >= 0.0 || value_d <= 1.0) {
+                       return SWITCH_TRUE;
+               }
+       }
+       return SWITCH_FALSE;
+}
+
 #define IKS_SHA256_HEX_DIGEST_LENGTH ((SHA256_DIGEST_LENGTH * 2) + 1)
 
 /**
index 442722a267b5ebb9c1845f50aa3780e28df6fc52..90a5ca688d076d38f9945868640b1a16bed74bc0 100644 (file)
@@ -73,101 +73,20 @@ extern char *iks_server_dialback_key(const char *secret, const char *receiving_s
 /** A function to validate attribute value */
 typedef int (*iks_attrib_validation_function)(const char *);
 
-#define ELEMENT(name) inline int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
+#define ELEMENT_DECL(name) extern int VALIDATE_##name(iks *node);
+#define ELEMENT(name) int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
 #define ATTRIB(name, def, rule) result &= iks_attrib_is_##rule(iks_find_attrib_default(node, #name, #def));
 #define STRING_ATTRIB(name, def, rule) result &= value_matches(iks_find_attrib_default(node, #name, #def), rule);
 #define ELEMENT_END return result; }
 
 extern int value_matches(const char *value, const char *rule);
 
-#define ATTRIB_RULE(rule) inline int iks_attrib_is_ ## rule (const char *value)
-
-/**
- * Validate boolean
- * @param value
- * @return SWTICH_TRUE if boolean
- */
-ATTRIB_RULE(bool)
-{
-       if (value && *value && (!strcasecmp("true", value) || !strcasecmp("false", value))) {
-               return SWITCH_TRUE;
-       }
-       return SWITCH_FALSE;
-}
-
-/**
- * Validate integer
- * @param value
- * @return SWTICH_TRUE if not negative
- */
-ATTRIB_RULE(not_negative)
-{
-       if (value && *value && switch_is_number(value)) {
-               int value_i = atoi(value);
-               if (value_i >= 0) {
-                       return SWITCH_TRUE;
-               }
-       }
-       return SWITCH_FALSE;
-}
-
-/**
- * Validate integer
- * @param value
- * @return SWTICH_TRUE if positive
- */
-ATTRIB_RULE(positive)
-{
-       if (value && *value && switch_is_number(value)) {
-               int value_i = atoi(value);
-               if (value_i > 0) {
-                       return SWITCH_TRUE;
-               }
-       }
-       return SWITCH_FALSE;
-}
-
-/**
- * Validate integer
- * @param value
- * @return SWTICH_TRUE if positive or -1
- */
-ATTRIB_RULE(positive_or_neg_one)
-{
-       if (value && *value && switch_is_number(value)) {
-               int value_i = atoi(value);
-               if (value_i == -1 || value_i > 0) {
-                       return SWITCH_TRUE;
-               }
-       }
-       return SWITCH_FALSE;
-}
-
-/**
- * Validate string
- * @param value
- * @return SWTICH_TRUE
- */
-ATTRIB_RULE(any)
-{
-       return SWITCH_TRUE;
-}
-
-/**
- * Validate decimal
- * @param value
- * @return SWTICH_TRUE if 0.0 <= x <= 1.0
- */
-ATTRIB_RULE(decimal_between_zero_and_one)
-{
-       if (value && *value && switch_is_number(value)) {
-               double value_d = atof(value);
-               if (value_d >= 0.0 || value_d <= 1.0) {
-                       return SWITCH_TRUE;
-               }
-       }
-       return SWITCH_FALSE;
-}
+extern int iks_attrib_is_bool(const char *value);
+extern int iks_attrib_is_not_negative(const char *value);
+extern int iks_attrib_is_positive(const char *value);
+extern int iks_attrib_is_positive_or_neg_one(const char *value);
+extern int iks_attrib_is_any(const char *value);
+extern int iks_attrib_is_decimal_between_zero_and_one(const char *value);
 
 #endif
 
diff --git a/src/mod/event_handlers/mod_rayo/rayo_elements.c b/src/mod/event_handlers/mod_rayo/rayo_elements.c
new file mode 100644 (file)
index 0000000..07051c1
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2013, Grasshopper
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is Grasshopper
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Rienzo <chris.rienzo@grasshopper.com>
+ *
+ * rayo_elements.c -- Rayo XML element definition
+ *
+ */
+#include "rayo_elements.h"
+
+/**
+ * <input> component validation
+ */
+ELEMENT(RAYO_INPUT)
+       STRING_ATTRIB(mode, any, "any,dtmf,voice")
+       ATTRIB(terminator,, any)
+       ATTRIB(recognizer,, any)
+       ATTRIB(language, en-US, any)
+       ATTRIB(initial-timeout, -1, positive_or_neg_one)
+       ATTRIB(inter-digit-timeout, -1, positive_or_neg_one)
+       ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one)
+       ATTRIB(min-confidence, 0, decimal_between_zero_and_one)
+       ATTRIB(max-silence, -1, positive_or_neg_one)
+       /* for now, only NLSML */
+       STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml")
+       /* internal attribs for prompt support */
+       ATTRIB(barge-event, false, bool)
+       ATTRIB(start-timers, true, bool)
+ELEMENT_END
+
+/**
+ * <output> component validation
+ */
+ELEMENT(RAYO_OUTPUT)
+       ATTRIB(start-offset, 0, not_negative)
+       ATTRIB(start-paused, false, bool)
+       ATTRIB(repeat-interval, 0, not_negative)
+       ATTRIB(repeat-times, 1, not_negative)
+       ATTRIB(max-time, -1, positive_or_neg_one)
+       ATTRIB(renderer,, any)
+       ATTRIB(voice,, any)
+ELEMENT_END
+
+/**
+ * <output><seek> validation
+ */
+ELEMENT(RAYO_OUTPUT_SEEK)
+       STRING_ATTRIB(direction,, "forward,back")
+       ATTRIB(amount,-1, positive)
+ELEMENT_END
+
+/**
+ * <prompt> component validation
+ */
+ELEMENT(RAYO_PROMPT)
+       ATTRIB(barge-in, true, bool)
+ELEMENT_END
+
+/**
+ * <record> component validation
+ */
+ELEMENT(RAYO_RECORD)
+       ATTRIB(format, mp3, any)
+       ATTRIB(start-beep, false, bool)
+       ATTRIB(stop-beep, false, bool)
+       ATTRIB(start-paused, false, bool)
+       ATTRIB(max-duration, -1, positive_or_neg_one)
+       ATTRIB(initial-timeout, -1, positive_or_neg_one)
+       ATTRIB(final-timeout, -1, positive_or_neg_one)
+       STRING_ATTRIB(direction, duplex, "duplex,send,recv")
+       ATTRIB(mix, false, bool)
+ELEMENT_END
+
+/**
+ * <join> command validation
+ */
+ELEMENT(RAYO_JOIN)
+       /* for now, only allow duplex
+       STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */
+       STRING_ATTRIB(direction, duplex, "duplex")
+       STRING_ATTRIB(media, bridge, "bridge,direct")
+       ATTRIB(call-uri,, any)
+       ATTRIB(mixer-name,, any)
+ELEMENT_END
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
+ */
+
index be2d68d054790aaf4eb2a15975e1b2d2d9646ccb..c780f160cf48cfcbf0db00b815c0a4f5c441625f 100644 (file)
@@ -23,7 +23,7 @@
  * Contributor(s):
  * Chris Rienzo <chris.rienzo@grasshopper.com>
  *
- * rayo_elements.h -- Rayo XML element definition
+ * rayo_elements.h -- Rayo XML elements
  *
  */
 #ifndef RAYO_ELEMENTS_H
 
 #include "iks_helpers.h"
 
-/**
- * <input> component validation
- */
-ELEMENT(RAYO_INPUT)
-       STRING_ATTRIB(mode, any, "any,dtmf,voice")
-       ATTRIB(terminator,, any)
-       ATTRIB(recognizer,, any)
-       ATTRIB(language, en-US, any)
-       ATTRIB(initial-timeout, -1, positive_or_neg_one)
-       ATTRIB(inter-digit-timeout, -1, positive_or_neg_one)
-       ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one)
-       ATTRIB(min-confidence, 0, decimal_between_zero_and_one)
-       ATTRIB(max-silence, -1, positive_or_neg_one)
-       /* for now, only NLSML */
-       STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml")
-       /* internal attribs for prompt support */
-       ATTRIB(barge-event, false, bool)
-       ATTRIB(start-timers, true, bool)
-ELEMENT_END
-
-/**
- * <output> component validation
- */
-ELEMENT(RAYO_OUTPUT)
-       ATTRIB(start-offset, 0, not_negative)
-       ATTRIB(start-paused, false, bool)
-       ATTRIB(repeat-interval, 0, not_negative)
-       ATTRIB(repeat-times, 1, not_negative)
-       ATTRIB(max-time, -1, positive_or_neg_one)
-       ATTRIB(renderer,, any)
-       ATTRIB(voice,, any)
-ELEMENT_END
-
-/**
- * <output><seek> validation
- */
-ELEMENT(RAYO_OUTPUT_SEEK)
-       STRING_ATTRIB(direction,, "forward,back")
-       ATTRIB(amount,-1, positive)
-ELEMENT_END
-
-/**
- * <prompt> component validation
- */
-ELEMENT(RAYO_PROMPT)
-       ATTRIB(barge-in, true, bool)
-ELEMENT_END
-
-/**
- * <record> component validation
- */
-ELEMENT(RAYO_RECORD)
-       ATTRIB(format, mp3, any)
-       ATTRIB(start-beep, false, bool)
-       ATTRIB(stop-beep, false, bool)
-       ATTRIB(start-paused, false, bool)
-       ATTRIB(max-duration, -1, positive_or_neg_one)
-       ATTRIB(initial-timeout, -1, positive_or_neg_one)
-       ATTRIB(final-timeout, -1, positive_or_neg_one)
-       STRING_ATTRIB(direction, duplex, "duplex,send,recv")
-       ATTRIB(mix, false, bool)
-ELEMENT_END
-
-/**
- * <join> command validation
- */
-ELEMENT(RAYO_JOIN)
-       /* for now, only allow duplex
-       STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */
-       STRING_ATTRIB(direction, duplex, "duplex")
-       STRING_ATTRIB(media, bridge, "bridge,direct")
-       ATTRIB(call-uri,, any)
-       ATTRIB(mixer-name,, any)
-ELEMENT_END
+ELEMENT_DECL(RAYO_INPUT)
+ELEMENT_DECL(RAYO_OUTPUT)
+ELEMENT_DECL(RAYO_OUTPUT_SEEK)
+ELEMENT_DECL(RAYO_PROMPT)
+ELEMENT_DECL(RAYO_RECORD)
+ELEMENT_DECL(RAYO_JOIN)
 
 #endif