[svn-commits] may: branch may/smpp r400914 - /team/may/smpp/branches/10/addons/res_smpp.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 14 17:08:58 CDT 2013


Author: may
Date: Mon Oct 14 17:08:57 2013
New Revision: 400914

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400914
Log:
add 'smpp show peers' command
remove sample unused codes

Modified:
    team/may/smpp/branches/10/addons/res_smpp.c

Modified: team/may/smpp/branches/10/addons/res_smpp.c
URL: http://svnview.digium.com/svn/asterisk/team/may/smpp/branches/10/addons/res_smpp.c?view=diff&rev=400914&r1=400913&r2=400914
==============================================================================
--- team/may/smpp/branches/10/addons/res_smpp.c (original)
+++ team/may/smpp/branches/10/addons/res_smpp.c Mon Oct 14 17:08:57 2013
@@ -1399,17 +1399,16 @@
 	return CLI_SUCCESS;
 }
 
-/* static char *handle_cli_mcu_show_conferences(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-#define FORMAT  "%24s %12s %24s %6s %6s %24s %6s\n"
-#define FORMAT2 "%24s %12s %24d %6d %6d %24s %6d\n"
-	struct mcu_conf *conf;
+static char *handle_cli_smpp_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+#define FORMAT "%24s %18s %9s %9s %12s %12s\n"
+#define FORMAT2 "%24s %18s %9s %9s %12s %12d\n"
 	switch (cmd) {
 		case CLI_INIT:
-			e->command = "mcu show conferences";
+			e->command = "smpp show peers";
 			e->usage =
-				"Usage: mcu show conferences\n"
-				"                Show list of mcu conferences\n";
+				"Usage: smpp show peers\n"
+				"                Show list of SMPP peers\n";
 			return NULL;
 		case CLI_GENERATE:
 			return NULL;
@@ -1418,99 +1417,29 @@
 	if (a->argc != 3)
 		return CLI_SHOWUSAGE;
 
-	ast_cli(a->fd, FORMAT, "Conference", "Mixer", "Conf ID", "Mosaic", "Size", "Profile", "Active");
-
-	ast_mutex_lock(&profiles_lock);
-	ast_mutex_lock(&mixers_lock);
-	ast_mutex_lock(&confs_lock);
-
-	conf = conf_list;
-	while (conf) {
-		ast_cli(a->fd, FORMAT2, conf->name, conf->mixer->host, conf->confId, conf->mosaic, conf->size,
-				conf->profile->name, conf->created);
-		conf = conf->next;
-	}
-
-	ast_mutex_unlock(&confs_lock);
-	ast_mutex_unlock(&mixers_lock);
-	ast_mutex_unlock(&profiles_lock);
+	ast_cli(a->fd, FORMAT, "Peer Name", "IP addr", "IP Port", "SMPP type", "Connected", "Sequence");
+
+	ast_mutex_lock(&smpp_lock);
+	struct smpp_smsc* smsc = smsc_list;
+	while (smsc) {
+		char port[9];
+		if (smsc->port) {
+			snprintf(port, sizeof(port), "%d", smsc->port);
+		} else {
+			strcpy(port, "any");
+		}
+		ast_cli(a->fd, FORMAT2, smsc->name, smsc->host, port, (smsc->esme) ? "esme" : "smsc",
+				(smsc->socket) ? "connected" : "not connect", smsc->seq);
+		smsc = smsc->next;
+	}
+	ast_mutex_unlock(&smpp_lock);
+
 
 	return CLI_SUCCESS;
 
 #undef FORMAT
 #undef FORMAT2
 }
-
-static char *handle_cli_mcu_show_mixers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-#define FORMAT "%24s %24s %12s %24s\n"
-#define FORMAT2 "%24s %24s %12d %24s\n"
-	struct mcu_mixer *mixer;
-	switch (cmd) {
-		case CLI_INIT:
-			e->command = "mcu show mixers";
-			e->usage =
-				"Usage: mcu show mixers\n"
-				"                Show list of MCU servers\n";
-			return NULL;
-		case CLI_GENERATE:
-			return NULL;
-	}
-
-	if (a->argc != 3)
-		return CLI_SHOWUSAGE;
-
-	ast_cli(a->fd, FORMAT, "Mixer", "Mgmt IP", "Mgmt Port", "Media IP");
-
-	ast_mutex_lock(&mixers_lock);
-	mixer = mixers_list;
-	while (mixer) {
-		ast_cli(a->fd, FORMAT2, mixer->name, mixer->host, mixer->port, mixer->media);
-		mixer = mixer->next;
-	}
-	ast_mutex_unlock(&mixers_lock);
-
-
-	return CLI_SUCCESS;
-
-#undef FORMAT
-#undef FORMAT2
-}
-
-static char *handle_cli_mcu_show_profiles(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-#define FORMAT "%24s %12s %12s %12s %12s\n"
-#define FORMAT2 "%24s %12d %12d %12d %12d\n"
-	struct mcu_profile *profile;
-	switch (cmd) {
-		case CLI_INIT:
-			e->command = "mcu show profiles";
-			e->usage =
-				"Usage: mcu show profiles\n"
-				"                Show list of mcu profiles\n";
-			return NULL;
-		case CLI_GENERATE:
-			return NULL;
-	}
-
-	if (a->argc != 3)
-		return CLI_SHOWUSAGE;
-
-	ast_cli(a->fd, FORMAT, "Profile", "Bitrate(KBps)", "FPS", "Size mode", "intraPeriod");
-	ast_mutex_lock(&profiles_lock);
-	profile = profiles_list;
-	while (profile) {
-		ast_cli(a->fd, FORMAT2, profile->name, profile->bitrate, profile->fps, profile->mode, profile->intraPeriod);
-		profile = profile->next;
-	}
-	ast_mutex_unlock(&profiles_lock);
-
-
-	return CLI_SUCCESS;
-
-#undef FORMAT
-#undef FORMAT2
-} */
 
 static const struct ast_msg_tech smpp_msg_tech = {
 	.name = "smpp",
@@ -1520,9 +1449,7 @@
 
 static struct ast_cli_entry cli_smpp[] = {
 	AST_CLI_DEFINE(handle_cli_smpp_set_debug,     "Enable/Disable SMPP debugging"),
-	/* AST_CLI_DEFINE(handle_cli_mcu_show_profiles,	     "Show MCU profiles"),
-	AST_CLI_DEFINE(handle_cli_mcu_show_mixers,	     "Show MCU mixers"),
-	AST_CLI_DEFINE(handle_cli_mcu_show_conferences,	     "Show MCU conferences"), */
+	AST_CLI_DEFINE(handle_cli_smpp_show_peers,	     "Show SMPP peers"),
 };
 
 static int load_module(void)




More information about the svn-commits mailing list