Commit 05413929 authored by tepelmann's avatar tepelmann
Browse files

Initial checkin.

Provides DHCPv6 message send function.
parent b03c6d6a
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
/**
 *	@author 	STF 440
 *  @version 	$Id$
 *	@desc		This module specifies common function definitions for DHCPv6
 */
 module LibIpv6_CommonRfcsDhcp_Functions {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl all;

	//LibIpv6
	import from LibIpv6_CommonRfcs_TypesAndValues all;
	import from LibIpv6_Interface_Functions all;
	import from LibIpv6_Interface_TypesAndValues all;
	import from LibIpv6_Rfc0768Udp_Templates all;
    import from LibIpv6_Rfc0768Udp_Functions all;
	import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;

	/**
	 * @desc Sends a DHCPv6 message wrapped in an UDP packet via IPv6.
	 * @param p_dhcpv6Msg The DHCPv6 message to send.
	 * @param p_src The IPv6 source address.
	 * @param p_dst The IPv6 destination address.
	 * @param p_srcPort The UDP source port.
	 * @param p_dstPort The UDP destination port.
	 * 
	 * @remark No further extension headers in the IPv6 packet.
	 * 
	 * @return Execution status
	 */
	function f_sendDhcpv6Msg (in template(value) DHCPv6Msg p_dhcpv6Msg,
							  in template(value) Ipv6Address p_src,
							  in template(value) Ipv6Address p_dst,
							  in template(value) UInt16 p_srcPort,
							  in template(value) UInt16 p_dstPort) 
	runs on LibIpv6Node
	return FncRetCode {
		var UdpPacket v_ipPkt;
		var bitstring v_encMsg := encvalue(p_dhcpv6Msg);
		
		v_ipPkt := m_udpPkt_noExtHdr_data(
						p_src, 
						p_dst, 
						int2oct(p_srcPort, 2), 
						int2oct(p_dstPort, 2), 
						bit2oct(v_encMsg)
					);

		return f_sendUdpPacket(v_ipPkt);
	
	}//end f_sendUdp
} // end module LibIpv6_Rfc0768Udp_Functions