IPA_Emulation: Add comments
diff --git a/library/IPA_Emulation.ttcn b/library/IPA_Emulation.ttcn
index 755cbba..61f357c 100644
--- a/library/IPA_Emulation.ttcn
+++ b/library/IPA_Emulation.ttcn
@@ -1,5 +1,12 @@
 module IPA_Emulation {
 
+/* This module implements the IPA multiplex protocol on top of TCP, using the IPL4asp
+ * test-port as provider.  It implements both client and server roles, as well was the CCM
+ * handshake for establishing the identity of the client to the server.  It already knows
+ * certain well-known sub-protocols such as A-bis RSL, MGCP and SCCP and transcodes messages
+ * so the user can work with abstract data types rather than binary messages.  It handles
+ * multiple packets inside one TCP segment */
+
 import from IPA_Types all;
 import from IPA_CodecPort all;
 import from IPA_CodecPort_CtrlFunct all;
@@ -33,6 +40,8 @@
 	ASP_IPA_EVENT_ID_ACK
 }
 
+/* an event indicating us whether or not a connection is physically up or down,
+ * and whether we have received an ID_ACK */
 type union ASP_IPA_Event {
 	ASP_IPA_EventUpDown	up_down
 }
@@ -48,6 +57,7 @@
 	payload := pl
 }
 
+/* like ASP_IPA_Unitdata, but with RSL_Message abstract type instead of octetstring */
 type record ASP_RSL_Unitdata {
 	IpaStreamId	streamId,
 	RSL_Message	rsl
@@ -67,14 +77,17 @@
 template IpaStreamId t_IpaSidRSL := ( IPAC_PROTO_RSL_TRX0, IPAC_PROTO_RSL_TRX1,
 				      IPAC_PROTO_RSL_TRX2, IPAC_PROTO_RSL_TRX3 );
 
+/* Client port for general IPA messages, not further decoded */
 type port IPA_SP_PT message {
 	inout ASP_IPA_Unitdata, ASP_IPA_Event;
 } with { extension "internal" }
 
+/* Client port for MGCP inside IPA */
 type port IPA_MGCP_PT message {
 	inout MgcpCommand, MgcpResponse;
 } with { extension "internal" }
 
+/* Client port for A-bis RSL inside IPA */
 type port IPA_RSL_PT message {
 	inout ASP_RSL_Unitdata, ASP_IPA_Event;
 } with { extension "internal" }
@@ -126,6 +139,7 @@
 	osmo_rand := ""
 };
 
+/* Function to use to connect as client to a remote IPA Server */
 function f_connect(charstring remote_host, PortNumber remote_port,
 		   charstring local_host, PortNumber local_port,
 		   IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars) runs on IPA_Emulation_CT {
@@ -141,6 +155,7 @@
 	g_is_bsc_mgw := true;
 }
 
+/* Function to use to bind to a local port as IPA server, accepting remote clients */
 function f_bind(charstring local_host, PortNumber local_port,
 		IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars) runs on IPA_Emulation_CT {
 	var Result res;
@@ -290,6 +305,7 @@
 	return ret;
 }
 
+/* main function to use for a client-side IPA implementation */
 function main_client(charstring remote_host, PortNumber remote_port,
 		     charstring local_host, PortNumber local_port,
 		     IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars) runs on IPA_Emulation_CT {
@@ -298,6 +314,7 @@
 	ScanEvents();
 }
 
+/* main function to use for a server-side IPA implementation */
 function main_server(charstring local_host, PortNumber local_port) runs on IPA_Emulation_CT {
 	g_mode := IPA_MODE_SERVER;
 	f_bind(local_host, local_port);
@@ -323,6 +340,7 @@
 	}
 }
 
+/* main loop function for both client and server. 'thread' of the component */
 private function ScanEvents() runs on IPA_Emulation_CT {
 	var IPA_RecvFrom ipa_rx;
 	var ASP_IPA_Unitdata ipa_ud;