BAL and Maple Release 2.2

Signed-off-by: Shad Ansari <developer@Carbon.local>
diff --git a/bal_release/src/common/bal_app_utils/Makefile b/bal_release/src/common/bal_app_utils/Makefile
new file mode 100644
index 0000000..2551bf6
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/Makefile
@@ -0,0 +1,36 @@
+###############################################################################
+#
+#  <:copyright-BRCM:2016:DUAL/GPL:standard
+#  
+#     Copyright (c) 2016 Broadcom
+#     All Rights Reserved
+#  
+#  Unless you and Broadcom execute a separate written software license
+#  agreement governing use of this software, this software is licensed
+#  to you under the terms of the GNU General Public License version 2
+#  (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+#  with the following added to such license:
+#  
+#     As a special exception, the copyright holders of this software give
+#     you permission to link this software with independent modules, and
+#     to copy and distribute the resulting executable under terms of your
+#     choice, provided that you also meet, for each linked independent
+#     module, the terms and conditions of the license of that module.
+#     An independent module is a module which is not derived from this
+#     software.  The special exception does not apply to any modifications
+#     of the software.
+#  
+#  Not withstanding the above, under no circumstances may you combine
+#  this software in any way with any other Broadcom software provided
+#  under a license other than the GPL, without Broadcom's express prior
+#  written consent.
+#  
+#  :>
+#
+###############################################################################
+# Common utilities
+#
+MOD_NAME = bal_app_utils
+MOD_TYPE = lib
+MOD_DEPS = dev_log maple_sdk
+srcs = bal_app_common_utils.c
diff --git a/bal_release/src/common/bal_app_utils/bal_app_common_utils.c b/bal_release/src/common/bal_app_utils/bal_app_common_utils.c
new file mode 100755
index 0000000..83894d6
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/bal_app_common_utils.c
@@ -0,0 +1,81 @@
+/******************************************************************************
+ *
+ *  <:copyright-BRCM:2016:DUAL/GPL:standard
+ *  
+ *     Copyright (c) 2016 Broadcom
+ *     All Rights Reserved
+ *  
+ *  Unless you and Broadcom execute a separate written software license
+ *  agreement governing use of this software, this software is licensed
+ *  to you under the terms of the GNU General Public License version 2
+ *  (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ *  with the following added to such license:
+ *  
+ *     As a special exception, the copyright holders of this software give
+ *     you permission to link this software with independent modules, and
+ *     to copy and distribute the resulting executable under terms of your
+ *     choice, provided that you also meet, for each linked independent
+ *     module, the terms and conditions of the license of that module.
+ *     An independent module is a module which is not derived from this
+ *     software.  The special exception does not apply to any modifications
+ *     of the software.
+ *  
+ *  Not withstanding the above, under no circumstances may you combine
+ *  this software in any way with any other Broadcom software provided
+ *  under a license other than the GPL, without Broadcom's express prior
+ *  written consent.
+ *  
+ *  :>
+ *
+ *****************************************************************************/
+ 
+/**
+ * @file bal_app_common_utils.c
+ * @brief BAL app common Utilities functionality
+ *
+ * @addtogroup util
+ */
+
+/*@{*/
+
+#include "bal_app_common_utils.h"
+
+/*****************************************************************************/
+/**
+* @brief app_util_parse_ip_port
+*
+* This routine is used to parse the user supplied IP address and port of the
+* remote MAC device.
+*
+* @param ip_port     A string containing the IP:port to parse
+*
+* @param ip          The IP address that results from the parsing function
+*
+* @param port        The port that results from the parsing function
+*
+* @return bcmos_errno
+*/
+/*****************************************************************************/
+bcmos_errno app_util_parse_ip_port(const char *ip_port, uint32_t *ip, uint16_t *port)
+{
+    int n;
+    uint32_t ip1, ip2, ip3, ip4, pp;
+
+    if (!ip_port)
+    {
+        bcmos_printf("ERR: ip_port is not set\n");
+        return BCM_ERR_PARM;
+    }
+    n = sscanf(ip_port, "%u.%u.%u.%u:%u", &ip1, &ip2, &ip3, &ip4, &pp);
+    if (n != 5 || ip1 > 0xff || ip2 > 0xff || ip3 > 0xff || ip4 > 0xff || pp > 0xffff)
+    {
+        bcmos_printf("ERR: Can't parse %s. Must be ip_address:port\n", ip_port);
+        return BCM_ERR_PARM;
+    }
+    *ip = (ip1 << 24) | (ip2 << 16) | (ip3 << 8) | ip4;
+    *port = pp;
+    return BCM_ERR_OK;
+}
+
+/*@}*/
+
diff --git a/bal_release/src/common/bal_app_utils/bal_app_common_utils.h b/bal_release/src/common/bal_app_utils/bal_app_common_utils.h
new file mode 100755
index 0000000..1db1b9f
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/bal_app_common_utils.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ *
+ *  <:copyright-BRCM:2016:DUAL/GPL:standard
+ *  
+ *     Copyright (c) 2016 Broadcom
+ *     All Rights Reserved
+ *  
+ *  Unless you and Broadcom execute a separate written software license
+ *  agreement governing use of this software, this software is licensed
+ *  to you under the terms of the GNU General Public License version 2
+ *  (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ *  with the following added to such license:
+ *  
+ *     As a special exception, the copyright holders of this software give
+ *     you permission to link this software with independent modules, and
+ *     to copy and distribute the resulting executable under terms of your
+ *     choice, provided that you also meet, for each linked independent
+ *     module, the terms and conditions of the license of that module.
+ *     An independent module is a module which is not derived from this
+ *     software.  The special exception does not apply to any modifications
+ *     of the software.
+ *  
+ *  Not withstanding the above, under no circumstances may you combine
+ *  this software in any way with any other Broadcom software provided
+ *  under a license other than the GPL, without Broadcom's express prior
+ *  written consent.
+ *  
+ *  :>
+ *
+ *****************************************************************************/
+ 
+/**
+ * @file bal_app_common_utils.h
+ * @brief BAL Utilities include file
+ *
+ * @defgroup util Bal App Util Routines
+ * @ingroup lib
+ */
+
+#ifndef _BAL_COMMON_UTILS_H
+#define _BAL_COMMON_UTILS_H
+
+/*@{*/
+
+#include <bcmos_system.h>
+#include <bcm_dev_log.h>
+#include <bal_msg.h>
+#include <bal_utils_msg.h>
+#include <bal_msg_type.h>
+#include <bal_objs.h>
+
+bcmos_errno app_util_parse_ip_port(const char *ip_port, uint32_t *ip, uint16_t *port);
+
+/*@}*/
+
+#endif /* _BAL_COMMON_UTILS_H*/