bsc: Allow to have a list of MSCs/MUXs to connect to

Be able to configure a list of destinations (duplicates allowed)
that will be tried in a round robin fashion. The change is in
the bsc_msc_connection to operate on a list. We achieve the
round robin nature with the same trick used in the paging code
to delete and append the current entry. The nat code was updated
to compile but one can only configure one destination.
diff --git a/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h
index ddaad3b..e3653ac 100644
--- a/openbsc/include/openbsc/bsc_msc.h
+++ b/openbsc/include/openbsc/bsc_msc.h
@@ -25,14 +25,22 @@
 #include <osmocom/core/write_queue.h>
 #include <osmocom/core/timer.h>
 
+struct bsc_msc_dest {
+	struct llist_head list;
+
+	char *ip;
+	int port;
+	int dscp;
+};
+
+
 struct bsc_msc_connection {
 	struct write_queue write_queue;
 	int is_connected;
 	int is_authenticated;
 	int first_contact;
-	const char *ip;
-	int port;
-	int prio;
+
+	struct llist_head *dests;
 
 	void (*connection_loss) (struct bsc_msc_connection *);
 	void (*connected) (struct bsc_msc_connection *);
@@ -40,7 +48,7 @@
 	struct timer_list timeout_timer;
 };
 
-struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio);
+struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
 int bsc_msc_connect(struct bsc_msc_connection *);
 void bsc_msc_schedule_connect(struct bsc_msc_connection *);
 
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 8d552e2..8fbed5b 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -1,6 +1,6 @@
 /*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
+ * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2011 by On-Waves
  * All Rights Reserved
  *
  * This program is free software; you can redistribute it and/or modify
@@ -236,8 +236,8 @@
 	int mgcp_length;
 
 	/* msc things */
-	char *msc_ip;
-	int msc_port;
+	struct llist_head dests;
+	struct bsc_msc_dest *main_dest;
 	struct bsc_msc_connection *msc_con;
 	char *token;
 
diff --git a/openbsc/include/openbsc/osmo_msc_data.h b/openbsc/include/openbsc/osmo_msc_data.h
index a35e6f2..f360da5 100644
--- a/openbsc/include/openbsc/osmo_msc_data.h
+++ b/openbsc/include/openbsc/osmo_msc_data.h
@@ -41,9 +41,6 @@
 
 	/* Connection data */
 	char *bsc_token;
-	int msc_port;
-	int msc_ip_dscp;
-	char *msc_ip;
 	int ping_timeout;
 	int pong_timeout;
 	struct timer_list ping_timer;
@@ -57,6 +54,9 @@
 	struct gsm_audio_support **audio_support;
 	int audio_length;
 
+	/* destinations */
+	struct llist_head dests;
+
 
 	/* mgcp agent */
 	struct write_queue mgcp_agent;