Index: [Article Count Order] [Thread]

Date: Fri, 20 Mar 2009 11:29:38 +0800
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Subject: [users:01125] Re: Need help to add a new Testcase in Tahi [v6eval-3-1-0]
To: users@tahi.org, girish_srikant@yahoo.com
Message-Id: <49C30DA2.7070108@cn.fujitsu.com>
In-Reply-To: <193127.98858.qm@web54506.mail.re2.yahoo.com>
References: <193127.98858.qm@web54506.mail.re2.yahoo.com>
X-Mail-Count: 01125

girish srikantaiah wrote:
> Hello Everyone,
>  
> Trying to add a new testcase in IPv6 SelfTest_4-0-3 for RDNSS Option  
> in Router advertisement.
>  
> Have tried to understand the existing Prefix option in Router 
> advertisment changes i.e McOpt_ICMPv6_Prefix class existing in  
> v6eval_3-0-12/lib/Pz/McICMPv6.h.
>  
> McOpt_ICMPv6_Prefix
> class McOpt_ICMPv6_Prefix :public McOpt_ICMPv6{
>
> public:
>
>       McOpt_ICMPv6_Prefix(CSTR);
>
> virtual     ~McOpt_ICMPv6_Prefix();
>
> static      McOpt_ICMPv6_Prefix* create(CSTR);
>
>       int32_t optionType()const{return TP_Opt_ICMPv6_Prefix;}
>
> };
>
>  
> Hence based on this understanding, we would like to follow this approach
> 1. Add a new class McOpt_ICMPv6_RDNSS in  *_McICMPv6.h_ *for v6eval to 
> parse RDNSS option successfully.
> 2. Add supporting methods *"**static McOpt_ICMPv6_Rdnss* 
> create(CSTR)"* in  McICMPv6.cc
> 3. Add LEXADD(McOpt_ICMPv6_Prefix, "Opt_ICMPv6_Rdnss" ) in McInit.cc

The patch you need should like this, compile test only:

diff --git a/lib/Pz/McICMPv6.cc b/lib/Pz/McICMPv6.cc
index 5e7572a..9387453
--- a/lib/Pz/McICMPv6.cc
+++ b/lib/Pz/McICMPv6.cc
@@ -259,6 +259,9 @@ McOpt_ICMPv6_AdvInterval::~McOpt_ICMPv6_AdvInterval() {}
 McOpt_ICMPv6_HomeAgentInfo::McOpt_ICMPv6_HomeAgentInfo(CSTR key):McOpt_ICMPv6(key) {}
 McOpt_ICMPv6_HomeAgentInfo::~McOpt_ICMPv6_HomeAgentInfo() {}
 
+McOpt_ICMPv6_RecursiveDNSServer::McOpt_ICMPv6_RecursiveDNSServer(CSTR key):McOpt_ICMPv6(key) {}
+McOpt_ICMPv6_RecursiveDNSServer::~McOpt_ICMPv6_RecursiveDNSServer() {}
+
 McOpt_ICMPv6_RouteInfo::McOpt_ICMPv6_RouteInfo(CSTR key): McOpt_ICMPv6(key) {}
 McOpt_ICMPv6_RouteInfo::~McOpt_ICMPv6_RouteInfo() {}
 
@@ -341,3 +344,16 @@ uint32_t McUpp_ICMPv6_MLDQuery::HC_MLC(SourceAddress)(const ItPosition &at, OCTB
 } 
 #undef MLDV2OFFSET
 #undef MLDV2ADDRLEN
+
+uint32_t McOpt_ICMPv6_RecursiveDNSServer::HC_MLC(Addr)(const ItPosition &at, OCTBUF &buf) const {
+	uint32_t count, len;
+	if(length_) {
+		len = length_->value(at, buf);
+		count = (len - 1) / 2;
+	} else {
+		len = buf.remainLength(at.bytes());
+		count = (len - 8) / 16;
+	}
+
+	return(count);
+} 
diff --git a/lib/Pz/McICMPv6.h b/lib/Pz/McICMPv6.h
index 32546b9..7986172
--- a/lib/Pz/McICMPv6.h
+++ b/lib/Pz/McICMPv6.h
@@ -81,6 +81,7 @@ const int32_t TP_Opt_ICMPv6_Redirected		=4;
 const int32_t TP_Opt_ICMPv6_MTU			=5;
 const int32_t TP_Opt_ICMPv6_AdvInterval		=7;
 const int32_t TP_Opt_ICMPv6_HomeAgentInfo	=8;
+const int32_t TP_Opt_ICMPv6_RDNSS		=25;
 
 #ifndef TBD_OPT_ROUTE_INFO
 #define TBD_OPT_ROUTE_INFO	200
@@ -421,6 +422,20 @@ class McOpt_ICMPv6_HomeAgentInfo: public McOpt_ICMPv6 {
 		}
 };
 
+class McOpt_ICMPv6_RecursiveDNSServer: public McOpt_ICMPv6 {
+	public:
+		McOpt_ICMPv6_RecursiveDNSServer(CSTR);
+		virtual	~McOpt_ICMPv6_RecursiveDNSServer();
+
+		static McOpt_ICMPv6_RecursiveDNSServer *create(CSTR);
+
+		int32_t optionType() const {
+			return(TP_Opt_ICMPv6_RDNSS);
+		}
+
+		DEC_HC_MLC(Addr);
+};
+
 class McOpt_ICMPv6_RouteInfo: public McOpt_ICMPv6 {
 	public:
 		McOpt_ICMPv6_RouteInfo(CSTR);
diff --git a/lib/Pz/McInit.cc b/lib/Pz/McInit.cc
index 8b3c518..0a9742c
--- a/lib/Pz/McInit.cc
+++ b/lib/Pz/McInit.cc
@@ -231,6 +231,7 @@ McObject::initialize()
 	LEXADD(McOpt_ICMPv6_MTU,		"Opt_ICMPv6_MTU" );
 	LEXADD(McOpt_ICMPv6_AdvInterval,	"Opt_ICMPv6_AdvInterval");
 	LEXADD(McOpt_ICMPv6_HomeAgentInfo,	"Opt_ICMPv6_HomeAgentInfo");
+	LEXADD(McOpt_ICMPv6_RecursiveDNSServer,	"Opt_ICMPv6_RDNSS");
 	LEXADD(McOpt_ICMPv6_RouteInfo,		"Opt_ICMPv6_RouteInfo");
 
 	// Mobility Header
@@ -1503,6 +1504,28 @@ McOpt_ICMPv6_HomeAgentInfo::create(CSTR key)
 	return(mc);
 }
 
+////////////////////////////////////////
+//  Recursive DNS Server Option     //
+////////////////////////////////////////
+McOpt_ICMPv6_RecursiveDNSServer *
+McOpt_ICMPv6_RecursiveDNSServer::create(CSTR key)
+{
+	McOpt_ICMPv6_RecursiveDNSServer *mc = new McOpt_ICMPv6_RecursiveDNSServer(key);
+
+	mc->common_member();
+	mc->member(new MmUint("Reserved",	16,	UN(0),	UN(0)));
+	mc->member(new MmUint("Lifetime",	32,	UN(0),	UN(0)));
+	mc->member(
+		new MmMultiple(
+			new MmV6Addr("Address", V6TN(), V6NUT()),
+			(METH_HC_MLC)&McOpt_ICMPv6_RecursiveDNSServer::HC_MLC(Addr)
+		)
+	);
+
+	MmOption_onICMPv6::add(mc);
+
+	return(mc);
+}
 
 
 //


> 4. Compile the v6eval source using "make"
> 5. Then shall install v6eval in usr/local/v6eval directory using 
> the following commands "make install"

after this, you can use Opt_ICMPv6_RDNSS to define Recursive DNS Server 
Option.

> 6. Then shall compose RDNSS testcase in SelfTest_4-0-3/ 
> via V6LCxxxx.seq and V6LCxxxx.def.
>  
> Could you please confirm the above steps are sufficient for v6eval to 
> parse the new option being added in V6LCxxx.seq and V6LCxxxx.def files.
>  
> Regards
> Girish 
>