Пример #1
0
inline EPlaceState PlaceStateCheck(string const & openingHours, time_t timestamp)
{
  OSMTimeRange oh(openingHours);
  auto future = system_clock::from_time_t(timestamp);
  future += minutes(15);
  size_t nowState = oh(timestamp).IsOpen() ? 0 : 1;
  size_t futureState = oh(system_clock::to_time_t(future)).IsOpen() ? 0 : 1;

  EPlaceState state[2][2] = {{EPlaceState::Open, EPlaceState::CloseSoon},
                             {EPlaceState::OpenSoon, EPlaceState::Closed}};

  return state[nowState][futureState];
}
Пример #2
0
TEST(unpack, convert_to_object_handle_direct)
{
    msgpack::sbuffer sbuf;
    msgpack::pack(sbuf, 1);
    msgpack::object_handle oh(msgpack::unpack(sbuf.data(), sbuf.size()));
    EXPECT_EQ(1, oh.get().as<int>());

}
Пример #3
0
bool wb_dbms::importDbody(pwr_tOid oid, size_t size, void *body)
{
    wb_dbms_dbody b(this, oid, size, body);
    wb_dbms_ohead oh(this, oid);
    pwr_tTime time;
    time_GetTime( &time);
    oh.get(m_txn);
    oh.dbTime(time);
    oh.upd(m_txn);
    b.ins(m_txn);
    return true;
}
Пример #4
0
bool wb_db::importRbody(pwr_tOid oid, size_t size, void *body)
{
  wb_db_rbody b(this, oid, size, body);
  wb_db_ohead oh(this, oid);
  pwr_tTime time;
  time_GetTime(&time);
  oh.get(m_txn);
  oh.rbTime(time);
  oh.put(m_txn);
  b.put(m_txn);
  return true;
}
Пример #5
0
// soucin 2 dlouhych cisel (Karatsubuv algoritmus)
// viz http://en.wikipedia.org/wiki/Karatsuba_algorithm#The_basic_step
LNum operator*(const LNum & a, const LNum & b) {
  // delsi z n-cif. cisel
  int n = b.get_size();
  LNum x(a);
  LNum y(b);
  if (a.get_size() > b.get_size()) {
    n = a.get_size();

    LNum oh(1);
    oh[0] = 0;
    y = oh & b;
  } else if (x.get_size() < y.get_size()) {
    LNum oh(1);
    oh[0] = 0;
    x = oh & a;
  }

  int m = n/2;

  if (n == 1) {                 // trivial cases
    LNum ret(1);
    ret[0] = (x[0] & y[0]);
    return ret;
  } else {                      // Karatsuba algorithm
    LNum x1 = cut(x, m, n-1);
    LNum x0 = cut(x, 0, m-1);

    LNum y1 = cut(y, m, n-1);
    LNum y0 = cut(y, 0, m-1);

    LNum z2 = x1 * y1;
    LNum z0 = x0 * y0;
    LNum tmp_sum = (x1+x0) * (y1+y0);
    LNum z1 = (tmp_sum - z2) - z0;

    return (shift_left(z2, 2*m) + shift_left(z1, m) + z0);
  }
}
Пример #6
0
/*
 *	Get()
 *	URLから取得
 */
uint
O2Boards::
Get(const char *url)
{
	const char *target_url = url ? url : DEFAULT_BBSMENU_URL;
	HTTPSocket *socket = new HTTPSocket(SELECT_TIMEOUT_MS, Profile->GetUserAgentA());

	HTTPHeader h(HTTPHEADERTYPE_REQUEST);
	if (LastModified)
		h.AddFieldDate("If-Modified-Since", LastModified);

	string out;
	HTTPHeader oh(HTTPHEADERTYPE_RESPONSE);
	if (!socket->request(target_url, h, NULL, 0)) {
		delete socket;
		return (0);
	}
	while (socket->response(out, oh) >= 0)
	{
		if (oh.contentlength) {
			if (out.size() - oh.length >= oh.contentlength)
				break;
		}
	}
	delete socket;

	if (oh.status != 200)
		return (oh.status);

	if (!Update(&out[oh.length]))
		return (0);

	strmap::iterator it = oh.fields.find("Last-Modified");
	if (it == oh.fields.end())
		it = oh.fields.find("Date");
	if (it == oh.fields.end())
		return (0);

	time_t t = oh.httpdate2time_t(it->second.c_str());
	LastModified = t;
/*
	TRACEA(it->first.c_str());
	TRACEA(": ");
	TRACEA(it->second.c_str());
	TRACEA("\n");
	TRACEA(ctime(&LastModified));
*/
	return (oh.status);
}
Пример #7
0
TEST(unpack, insufficient_bytes_object_handle)
{
    msgpack::sbuffer sbuf;
    msgpack::pack(sbuf, 255); // uint8 (2bytes)

    std::size_t off = 0;

    msgpack::unpacked msg;
    try {
        msgpack::object_handle oh(msgpack::unpack(sbuf.data(), 1, off));
        EXPECT_TRUE(false);
    }
    catch (msgpack::insufficient_bytes const&) {
        EXPECT_TRUE(true);
        EXPECT_EQ(off, 0u);
    }
}
Пример #8
0
std::string jumping() {
  OHash oh(false); //Writing without assuming sparse.
  char buf[4096];
  for (int index=0;index<4096;index++) {
    buf[index]=index%128;
  }
  oh.written_chunk(buf+1024,2048,1024); //Must be ignored
  oh.written_chunk(buf,2048,0); //First half
  oh.written_chunk(buf+1024,2048,1024); //Overlapping chunk, this means a reset.
  oh.written_chunk(buf+1000,1000,1000); //Must be ignored again.
  oh.written_chunk(buf+3000,1096,3000); //Final overlapping chunk, must be ignored.
  oh.written_chunk(buf,2048,0); //First half again.
  oh.written_chunk(buf+3000,1096,3000); //Final chunk, must be ignored again.
  oh.written_chunk(buf+2048,1024,2048); //This should be processed.
  oh.written_chunk(buf+4000,96,4000); //Final overlapping chunk, must be ignored again.
  oh.written_chunk(buf+3072,1024,3072); //This should be processed, we should have everything now.
  oh.done();
  return oh.result();
}; 
Пример #9
0
TEST(unpack, insufficient_bytes_object_handle)
{
    msgpack::sbuffer sbuf;
    msgpack::pack(sbuf, 255); // uint8 (2bytes)

    std::size_t off = 0;

    try {
        msgpack::object_handle oh(msgpack::unpack(sbuf.data(), 1, off));
        EXPECT_TRUE(false);
    }
    catch (msgpack::insufficient_bytes const&) {
        EXPECT_TRUE(true);
#if MSGPACK_DEFAULT_API_VERSION < 3
        EXPECT_EQ(off, 0u);
#else  // MSGPACK_DEFAULT_API_VERSION < 3
        EXPECT_EQ(1u, off);
#endif // MSGPACK_DEFAULT_API_VERSION < 3
    }
}
Пример #10
0
int __stdcall WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd)
{
	std::wstring wsIni(512, 0);
	GetModuleFileName(hInstance, &wsIni[0], 511);
	PathRemoveExtension(&wsIni[0]);
	wcscat(&wsIni[0], L".ini");

	std::wstring wcRunPath(512, 0);
	GetModuleFileName(hInstance, &wcRunPath[0], 511);
	PathRemoveFileSpecW(&wcRunPath[0]);

	std::wstring wcExe(512, 0);
	GetModuleFileName(hInstance, &wcExe[0], 511);

	OptionsHelper oh(wsIni, wcExe);
	SoundHelper sh(wcRunPath + L"\\resources\\error.wav", wcRunPath + L"\\resources\\switch.wav");

	g_switcher = std::unique_ptr<Switcher>(new Switcher(oh, sh));

	g_bHookActive = true;

	g_hKbdHook = SetWindowsHookEx(WH_KEYBOARD_LL, SwitcherKeyboardHook, hInstance, NULL);
	g_switcher->Enable();
	// assert

	if (!IsDebuggerPresent()) g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, SwitcherMouseHook, hInstance, NULL);
	// assert

	AppDlg dlg(hInstance, *g_switcher, oh);
	dlg.ShowDlg();

	g_bHookActive = false;
	UnhookWindowsHookEx(g_hKbdHook);
	if (!IsDebuggerPresent()) UnhookWindowsHookEx(g_hMouseHook);

	oh.SaveOptions();

	return 0;
}
Пример #11
0
// celociselne deleni 2 dlouhych cisel (stredoskolsky algoritmus)
// -- viz http://courses.cs.vt.edu/~cs1104/BuildingBlocks/divide.030.html
LNum operator/(LNum & dividend, LNum & divisor) {
  LNum quotient(1);
  quotient[0] = 0;
  to_normal_form(dividend);
  to_normal_form(divisor);

  // deleni nulou !!
  if (divisor.get_size() == 1 && divisor[0] == 0) {
    cout << "Division by zero!! Returning \"0\"!" << endl;
    return quotient;
  }

  // deleni mensiho cisla vetsim -> podil == 0
  if (dividend < divisor) {
    LNum oh(1);
    return oh;
  }

  // zarovnej delitel do leveho rohu delence
  int lock = dividend.get_size() - divisor.get_size();  // zarazka zpracovavane
                                                        // cifry v dividendu
  LNum portion = cut(dividend, lock, dividend.get_size()-1);

  do {
    if (!(portion<divisor)) {
      portion = portion - divisor;
      quotient.append(1);
    } else {
      quotient.append(0);
    }
    if (--lock >= 0) {
      portion.append(dividend[lock]);
    }
  } while (lock >= 0);

  to_normal_form(quotient);

  return quotient;
}
Пример #12
0
std::string bdoc::SignatureValidator::getTMSignature()
{
    std::string ret;

    X509Cert ocspCert(sk_X509_value(_ocspCerts, 0));

    std::auto_ptr<Digest> ocspResponseCalc =
        Digest::create(_conf->getDigestURI());

    ocspResponseCalc->update(_ocspResponse);
    std::vector<unsigned char>
    ocspResponseHash = ocspResponseCalc->getDigest();

    std::auto_ptr<xercesc::DOMDocument> doc = _sig->createDom();
    xercesc::DOMNodeList *nl =
        doc->getElementsByTagNameNS(
            xercesc::XMLString::transcode("*"),
            xercesc::XMLString::transcode("UnsignedProperties"));

    xercesc::DOMNode *unsignedprops = nl->item(0);
    xercesc::DOMNode *unsignedsignatureprops =
        doc->createElement(
            xercesc::XMLString::transcode(
                "UnsignedSignatureProperties"));

    unsignedprops->appendChild(unsignedsignatureprops);

    {
        X509Cert issuerCert(_issuerX509);
        addXMLCertificateValues(doc.get(), unsignedsignatureprops,
                                ocspCert, issuerCert);
    }

    {
        xml_schema::Base64Binary resp(&_ocspResponse[0],
                                      _ocspResponse.size());
        addXMLRevocationValues(doc.get(), unsignedsignatureprops,
                               resp);
    }

    {
        X509* ocspIssuerCert =
            _conf->getCertStore()->getCert(
                *(ocspCert.getIssuerNameAsn1()));

        X509_scope ocspIssuerCertScope(&ocspIssuerCert);
        if (ocspIssuerCert == NULL) {
            THROW_STACK_EXCEPTION(
                "Failed to load issuer certificate.");
        }

        X509Cert oic(ocspIssuerCert);
        std::vector<unsigned char> der = oic.encodeDER();
        std::string oicmeth(_conf->getDigestURI());
        std::auto_ptr<bdoc::Digest> oicCalc =
            bdoc::Digest::create(oicmeth);
        oicCalc->update(der);
        xml_schema::Base64Binary oicDig(&oicCalc->getDigest()[0],
                                        oicCalc->getSize());

        addXMLCompleteCertificateRefs(doc.get(),
                                      unsignedsignatureprops,
                                      oic, oicDig, oicmeth);
    }

    {
        xml_schema::Base64Binary oh(&ocspResponseHash[0],
                                    ocspResponseHash.size());

        addXMLCompleteRevocationRefs(
            doc.get(), unsignedsignatureprops,
            ocspCert, oh, ocspResponseCalc->getUri(),
            bdoc::util::date::xsd2string(
                bdoc::util::date::
                makeDateTime(_producedAt)));
    }

    xercesc::DOMElement* root (doc->getDocumentElement ());
    ret = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    ret += serializeDOM(root);
    return ret;
}
/*! \brief Write the analyzed data to a file
*/
void nec_radiation_pattern::write_to_file_aux(ostream& os)
{
	if (false == m_analysis_done)
		throw new nec_exception("Internal Error: Radiation Pattern Analysis not done");
	
	static const char  *hpol[4] = { "LINEAR", "RIGHT ", "LEFT  ", " " };
	static const char  *gain_type[2] = { "----- POWER GAINS ----- ", "--- DIRECTIVE GAINS ---" };
	static const char  *igax[4] = { " MAJOR", " MINOR", " VERTC", " HORIZ" };
	
	int i;
	
	output_helper oh(os,_result_format);
		
	if ( _ifar >= 2) 
	{
		oh.section_start("FAR FIELD GROUND PARAMETERS");
		
		if ( _ifar > 3)
		{
			os << endl;
			os << "                                        RADIAL WIRE GROUND SCREEN" << endl;
			os << "                                        "; oh.int_out(5, m_ground.radial_wire_count); os << " WIRES" << endl;
			os << "                                        WIRE LENGTH= "; oh.real_out(8,2, m_ground.radial_wire_length,false); os << " METERS" << endl;
			os << "                                        WIRE RADIUS= "; oh.real_out(10,3, m_ground.radial_wire_radius); os << " METERS" << endl;
		} /* if ( _ifar > 3) */
		
		if ( _ifar != 4 ) 
		{
			std::string hclif;
			if ( (_ifar == 2) || (_ifar == 5) )
				hclif = "LINEAR";
			if ( (_ifar == 3) || (_ifar == 6) )
				hclif= "CIRCLE";
		
		
			os << endl;
			os << "                                        " << hclif << " CLIFF" << endl;
			os << "                                        EDGE DISTANCE= "; oh.real_out(9,2,m_ground.cliff_edge_distance,false); os << " METERS" << endl;
			os << "                                        HEIGHT= "; oh.real_out(8,2,m_ground.cliff_height,false); os << " METERS" << endl;
			os << "                                        SECOND MEDIUM -" << endl;
			os << "                                        RELATIVE DIELECTRIC CONST.= "; oh.real_out(7,3,m_ground.epsr2, false); os << endl;
			os << "                                        CONDUCTIVITY= "; oh.real_out(10,3,m_ground.sig2,false); os << " MHOS" << endl;
		} /* if ( _ifar != 4 ) */
		
	} /* if ( _ifar >= 2) */

	if ( _ifar == 1)
	{
		oh.section_start("RADIATED FIELDS NEAR GROUND");
		os << "    ------- LOCATION -------     --- E(THETA) ---     ---- E(PHI) ----    --- E(RADIAL) ---" << endl;
		os << "      RHO    PHI        Z           MAG    PHASE         MAG    PHASE        MAG     PHASE" << endl;
		os << "    METERS DEGREES    METERS      VOLTS/M DEGREES      VOLTS/M DEGREES     VOLTS/M  DEGREES" << endl;
	}
	else // _ifar != 1
	{
		oh.section_start("RADIATION PATTERNS");
		
		if ( m_range >= 1.0e-20)
		{
			nec_float exrm = 1.0 / m_range;
			nec_float exra = m_range/ _wavelength;
			exra = -360.0*(exra - floor(exra));
		
			os << "                             RANGE: "; oh.real_out(13,6,m_range); os << " METERS" << endl;
			os << "                             EXP(-JKR)/R: "; oh.real_out(12,5,exrm); os << " AT PHASE: "; oh.real_out(7,2,exra,false); os << " DEGREES" << endl;
		}
		
		int itmp1 = 2 * m_rp_output_format;
		int itmp2 = itmp1+1;
		
		os << " ---- ANGLES -----     "; oh.string_out(23,gain_type[m_rp_ipd]); os << "      ---- POLARIZATION ----   ---- E(THETA) ----    ----- E(PHI) ------" << endl;
		os << "  THETA      PHI      "; oh.string_out(6,igax[itmp1]); os << "  "; oh.string_out(6,igax[itmp2]); os << "   TOTAL       AXIAL      TILT  SENSE   MAGNITUDE    PHASE    MAGNITUDE     PHASE" << endl;
		os << " DEGREES   DEGREES        DB       DB       DB       RATIO   DEGREES            VOLTS/M   DEGREES     VOLTS/M   DEGREES" << endl;
		
	} /* if ( _ifar == 1) */


	i=0;
	nec_float phi = m_phi_start- delta_phi;

	for (int kph = 1; kph <= n_phi; kph++ )
	{
		phi += delta_phi;
		nec_float thet= m_theta_start- delta_theta;
		
		for(int kth = 1; kth <= n_theta; kth++ )
		{
			thet += delta_theta;
			if ( m_ground.present() && (thet > 90.01) && (_ifar != 1) )
				continue;
		
			/* elliptical polarization */
			if ( _ifar == 1)
			{
				nec_complex e_theta = _e_theta[i];
				nec_complex e_phi = _e_phi[i];
				nec_complex e_r = _e_r[i];
				
				oh.start_record();
				oh.padding(" ");
				oh.real_out(9,2,m_range,false);
				oh.separator(); oh.real_out(7,2,phi,false);
				oh.separator(); oh.real_out(9,2,thet,false);
				oh.separator(); oh.real_out(11,4,abs(e_theta));
				oh.separator(); oh.real_out(7,2,arg_degrees(e_theta),false); 
				oh.separator(); oh.real_out(11,4,abs(e_phi));
				oh.separator(); oh.real_out(7,2,arg_degrees(e_phi),false);
				oh.separator(); oh.real_out(11,4,abs(e_r));
				oh.separator(); oh.real_out(7,2,arg_degrees(e_r),false);
				oh.end_record();
			}
			else
			{
				nec_complex e_theta = _e_theta[i];
				nec_complex e_phi = _e_phi[i];
				
				const char* pol_sense = hpol[_polarization_sense_index[i]];
				
				oh.start_record();
				oh.padding(" ");
				oh.real_out(7,2,thet,false); oh.separator(); oh.real_out(9,2,phi,false); oh.separator();
				oh.padding(" ");
				oh.real_out(8,2,_power_gain_vert[i],false);
				oh.separator(); oh.real_out(8,2,_power_gain_horiz[i],false);
				oh.separator(); oh.real_out(8,2,_power_gain_tot[i],false);
				oh.separator(); oh.real_out(11,4,_polarization_axial_ratio[i],false);
				oh.separator(); oh.real_out(9,2,_polarization_tilt[i],false);
				oh.separator(); oh.string_out(6,pol_sense);
				oh.separator(); oh.real_out(11,4,abs(e_theta));
				oh.separator(); oh.real_out(9,2,arg_degrees(e_theta),false);
				oh.separator(); oh.real_out(11,4,abs(e_phi));
				oh.separator(); oh.real_out(9,2,arg_degrees(e_phi),false);
				oh.end_record();
				
				m_plot_card.plot_patterns(thet, phi,
					e_theta, e_phi,
					_power_gain_vert[i], _power_gain_horiz[i], _power_gain_tot[i]);
				
			} /* if ( _ifar != 1) */
		
			i++;
		} /* for( kth = 1; kth <= n_theta; kth++ ) */
	
	} /* for( kph = 1; kph <= n_phi; kph++ ) */

	if ( m_rp_power_average != 0)
	{		
		oh.section_end();
		os << "  AVERAGE POWER GAIN: "; oh.real_out(11,4,_average_power_gain); 
		os << " - SOLID ANGLE USED IN AVERAGING: ("; oh.real_out(7,4,_average_power_solid_angle,false);
		os << ")*PI STERADIANS" << endl;
	}

	if ( m_rp_normalization != 0)
		write_normalized_gain(os);
}
void nec_radiation_pattern::write_normalized_gain(ostream& os)
{
	// if  is non-zero then use it as a normaliztion factor
	
	nec_float normalization_factor = get_gain_normalization_factor(m_rp_gnor);
		
	string norm_type;
	switch (m_rp_normalization)
	{
		case 1:
			norm_type = "MAJOR AXIS"; break;
		case 2:
			norm_type = "MINOR AXIS"; break;
		case 3:
			norm_type = "VERTICAL"; break;
		case 4:
			norm_type = "HORIZONTAL"; break;
		case 5:
			norm_type = "TOTAL "; break;
		
		default: throw new nec_exception("Unknown Gain Normalization Encountered.");
	}
	
	output_helper oh(os,_result_format);
	
	oh.section_start("NORMALIZED GAIN");
	{ stringstream mess;	mess << norm_type << " GAIN";	oh.center_text(mess.str(), ""); }
	{ stringstream mess;	mess << "NORMALIZATION FACTOR: " << normalization_factor << " dB"; oh.center_text(mess.str(), ""); }
/*	os << "                                      " << norm_type << " GAIN" << endl;
	os << "                                   NORMALIZATION FACTOR: "; oh.real_out(7,2,normalization_factor,false); os << " db" << endl << endl; */
	os << "    ---- ANGLES ----                ---- ANGLES ----                ---- ANGLES ----" << endl;
	os << "    THETA      PHI        GAIN      THETA      PHI        GAIN      THETA      PHI       GAIN" << endl;
	os << "   DEGREES   DEGREES        DB     DEGREES   DEGREES        DB     DEGREES   DEGREES       DB" << endl;

	
	int row_count = 0;
	int n_cols = 3;
	
	int item_count = 0;
	for (int p=0;p<n_phi;p++)
	{
		nec_float phi = m_phi_start + p*delta_phi ;
		for (int t=0;t<n_theta;t++)
		{

			nec_float theta = m_theta_start + t * delta_theta;
			nec_float norm_gain = _gain[item_count++] - normalization_factor;
			
			oh.start_record();
			oh.padding(" ");
			
			oh.real_out(9,2,theta,false);
			oh.separator(); oh.real_out(9,2,phi,false);
			oh.separator(); oh.real_out(9,2,norm_gain,false);
			oh.padding(" ");
			
			if (_result_format == RESULT_FORMAT_NEC)
			{
				if (item_count % n_cols == 0)
				{
					row_count++;
					oh.end_record();
				}
			}
			else
			{
				oh.end_record();
			}
		}
	}
	os << endl;
}
Пример #15
0
//
//	CDefaultOptionsHook::ApplyL
//	***************************
//	The default Options processing (code shared by Destination Options and
//	Hop-by-Hop Options).
//
TInt CDefaultOptionsHook::ApplyL(RMBufHookPacket &aPacket, RMBufRecvInfo &aInfo)
	{
	if (aInfo.iVersion == 4)
		{
		//
		// Do not process HBH or DOP for IPv4. Returning PASS
		// will cause the main loop eventually to treat this
		// as unknown header, if nothing else handles it.
		//
		return KIp6Hook_PASS;
		}
	for (;;)	// .. just for exits.. not a loop..
		{
		TInet6Packet<TInet6Options> oh(aPacket, aInfo.iOffset);
		if (oh.iHdr == NULL)
			break;	// Bad packet, not enough for even the basic header
		const TInt hdrlen = aInfo.CheckL(oh.iHdr->HeaderLength());
		const TInt next_header = oh.iHdr->NextHeader();

		if (aInfo.iIcmp == 0)
			{
			//
			// Normal Option Header Handling
			//
			TInt count = hdrlen - TInet6Options::O_Options;			// Count of bytes in actual options.
			TInt start = aInfo.iOffset + TInet6Options::O_Options;	// Offset of the first
			//
			// Possibly heavy overhead, brute RMBuf Goto application
			// (but should work always)
			//
			while (count > 0)
				{
				RMBuf *p;
				TInt offset, len;
				TUint8 *ptr, type;

				if (!aPacket.Goto(start, p, offset, len))
					goto drop_packet;
				ptr = p->Buffer() + offset;
				switch ((type = *ptr++))
					{
				case 0:	// Pad1
					count--;
					start++;
					break;
#if 0
				case KDstOptionHomeAddress:
					if (aInfo.iProtocol == STATIC_CAST(TInt, KProtocolInet6DestinationOptions) &&
						// ..just check that there is enough stuff in the buffer
						// for the IPv6 address, so that the following CopyOut
						// does not panic. If not, just fall through. Should
						// do some better validity checking someday -- msa
						STATIC_CAST(TUint, count) >= sizeof(TIp6Addr)+2)
						{
						// This is shared between DOP and HBH, but this option is only
						// accepted in the DestinationOptions. The home address value
						// is simply copied to the aInfo.iDstAddr!
						//
						TIp6Addr home;
						TPtr8 ptr(home.u.iAddr8, sizeof(home.u.iAddr8), sizeof(home.u.iAddr8));

						aPacket.CopyOut(ptr, start+2);
						TInetAddr::Cast(aInfo.iSrcAddr).SetAddress(home);
#ifdef _LOG
							{
							TBuf<70> tmp_src;
							TInetAddr::Cast(aInfo.iSrcAddr).OutputWithScope(tmp_src);
							Log::Printf(_L("CDefaultOptionsHook::ApplyL: HOMEADDRESS src=[%S]\r\n"), &tmp_src);
							}
#endif
						aInfo.iFlags &= ~KIpAddressVerified;		// Request Address Check!
						goto skip_option;
						}
#endif
					// If not handled, fall unknown option handling!
				default:
					//
					// Unknown options
					//
					// 11 - send ICMP only if not Multicast dst
					// 10 - send ICMP
					// 01 - drop without ICMP
					// 00 - skip and continue
					//
					// (use HookValue with keyid=(protocol | (type << 8)) to check if someone else
					// already handled/implemented this option!)
					//
					if ((type & 0xC0) != 0 && aPacket.HookValue(aInfo.iProtocol | (type << 8)) == 0)
						{
						type &= 0xC0;
						if (type == 0xC0)
							{
							if (TIp46Addr::Cast(TInetAddr::Cast(aInfo.iDstAddr).Ip6Address()).IsMulticast())
								goto drop_packet;
							}
						else if (type != 0x80)
							goto drop_packet;
						//
						// Either 11 without multicast or 10, send ICMP6 Parameter Promblem,
						//
						iProtocol->Icmp6Send(aPacket, KInet6ICMP_ParameterProblem, 2, start, 1 /* Allow MC destination */);
						return -1;
						}
					//
					// 00 - Skip Over
					//
					// ** FALL THROUGH TO THE PadN handling, skip option **
				case 1:	// PadN
#if 0
skip_option:
#endif
					--len;
					while (len == 0)	// Should loop only once, but 'while' just in
										// case someone wants RMBuf with zero length...
						{
						p = p->Next();
						if (p == NULL)
							goto drop_packet;
						len = p->Length();
						ptr = p->Ptr();
						}
					count -= 2 + *ptr;
					start += 2 + *ptr;
					break;
					}
				}
			// Fall to "header processed"!
			}
		else if (aInfo.iIcmp == KProtocolInet6Icmp)
			{
			//
			// ICMP6 Problem report for a packet
			//
			const TInt offset = aInfo.iOffset - aInfo.iOffsetIp;	// Relative offset within problem packet

			if (aInfo.iType == KInet6ICMP_ParameterProblem &&	// A parameter problem...
				offset <= (TInt)aInfo.iParameter &&			// after start of this header?
				offset + hdrlen > (TInt)aInfo.iParameter)		// and before end of this header?
				break;		// Drop!
			// Fall to "header processed"!
			}
		else
			{
			//
			// ICMP v4 problem report (or something else)
			//
			// * just drop it for now*
			//
			break;
			}
		//
		// Gets Here only if the header is "processed" successfully
		// Remove options header, pass error processing to the next header
		//
		aInfo.iPrevNextHdr = (TUint16)aInfo.iOffset;	// Dest. Opt next header is at +0
		aInfo.iProtocol = next_header;
		aInfo.iOffset += hdrlen;
		return KIp6Hook_DONE;
		}
	//
	// All breakouts from the above "loop" cause the packet to be dropped
	//
drop_packet:
	aPacket.Free();
	return -1;
	}