Exemple #1
0
static void setIpAddr(ByteVector &result,mg_con_t *mgp)
{
	// This is the IP address, only IPv4 supported.
	// If the MS asks for IPv6, it is supposed to accept IPv4 anyway.
	result = ByteVector(6);// IPv4 address + 2 byte header.
	// 3GPP 24.008 10.5.6.4
	result.setByte(0,0x01); // IETF allocated address, which is all we support.
	result.setByte(1,0x21);	// IPv4.
	// This is a special case - we cannot use setUIint32 because it converts to network order,
	// but the ip address is already in network order, which is what 3GPP requires, so just copy it.
	memcpy(result.begin()+2, &mgp->mg_ip, 4);
	printf("IP address: %0x\n",mgp->mg_ip);
}