How to access the Internet inside the module in pipe mode
========================================
Problem Statement
1826 PIPE mode works as follows: The IP address obtained by dial will be directly assigned to DAP. 
DAP sends the packet to 1826 via usb, the mrvlpipe driver intercepts and parses the IP header of 
the packet to determine whether to forward it to the slowpath or CCINETX and it also determine 
whether to forward to the slowpath or usb driver for downlink packets. 
Since there was no IP address configured for the local ccinetX, you cannot use the local ccinetX 
to send packets to the internet in 1826. For VoIP services, if the VoIP stack is placed inside 1826, 
the SIP packets cannot be sent to the sever.

Share network in pipe mode is a technique meant to address this limitation. It will configures the 
IP address for the local CCINETX automatically and uses the tuple info to distinguish between internal 
and external access to the Internet.

Notice:
	1) Before use this function, you need to understand a constraint that only certain items that are 
	accessed to the net internally can add their tuple information.
	2) Not support large packets, i.e. fragment packet, you need to control the packet length to be less 
	than MTU(default 1500).
	
Here we take the VoIP as an example. Other services are similar.
----------------------------------------------------------------------------
Steps needed:	
1.	make menuconfig, selects "Global build settings"->"Config support internal access to the internet in pipe mode"
	and save to .config 
and build
	make -j8 V=99

2. Use SWDownloader to burn all bin files into the board

3. Switch to pipe mode by AT command and reboot
	AT+ACONFIG="PIPE=1"
	
4. After reboot, you can see that there is also an IPv4 address on the local ccinetX, which is same with the IPv4 
address obtained by DAP. If you still need an IPv6 address, you can do that:
	AT+CGDCONT=1,"IPV4V6","gprs"
	AT+CGACT=1,1
If dialed successful, you can see two IPv6 addresses on your local ccinetX, one is a link address and the other is 
a global address, looks like this:
	ccinet0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
			  inet addr:10.211.1.161  Mask:255.255.255.0
			  inet6 addr: fe80::1fb6:d1ac:88a1:e2c6/64 Scope:Link
			  inet6 addr: 2409:8930:2a3:1582:1fb6:d1ac:88a1:e2c6/64 Scope:Global
			  UP RUNNING NOARP  MTU:1500  Metric:1
		  
5. Test
	Before test whether the link from the local CCINETX to the SIP server is working, you need to add a tuple info 
to the "/sys/kernel/mpipe/database/tuple" to support ping the SIP server on 1826. For example,
	echo 1 4 10.211.1.161 10.21.10.145 1 2048 1 > /sys/kernel/mpipe/database/tuple
and then 
	ping 10.21.10.145 -I 10.211.1.161
The usage for add the tuple info is as follows:
echo [option] [version] [src_ip] [dst_ip] [sport] [dport] [protocol] > /sys/kernel/mpipe/database/tuple
option:
	0------del all tuple info;
	1------add a specified tuple info;
	2------del a specified tuple info.
		  
6. In order to notify the mrvlpipe driver to forward the downlink packets locally, you need add the following sample 
code to the VoIP stack and get the IP version, source IP, destination IP, source port, destination port, protocol, 
and call this function before sends packets.

	static int handle_tuple(TUPLE_CMD cmd, int version, char *src_ip, 
							char *dst_ip, int sport, int dport, int proto)
	{
		FILE *fp;
		char write_buf[100] = {0};
		int ret = 0;

		fp = fopen("/sys/kernel/mpipe/database/tuple", "a+");
		if(fp == NULL)
		{
			printf("handle_tuple: /sys/kernel/mpipe/database/tuple is not exit\n");
			return -1;
		}
		snprintf(write_buf, sizeof(write_buf), "%u %u %s %s %u %u %u\r\n", cmd, version, src_ip, dst_ip, sport, dport, proto);
		if(fwrite(write_buf, 1, strlen(write_buf), fp ) != strlen(write_buf))
		{
			printf("handle_tuple: file write error (size=%d)\n", strlen(write_buf));
			ret = -1;
		}

		fclose(fp);

		return ret;
	}

