Permalink
Browse files

Minor fixes.

  • Loading branch information...
1 parent 2ff9306 commit 503ca2c6cdfe883821c107d1132319a5508deff1 @tomaszmrugalski committed Jun 21, 2004
Showing with 52 additions and 67 deletions.
  1. +5 −2 AddrMgr/AddrIA.cpp
  2. +2 −0 CHANGELOG
  3. +17 −30 Messages/Msg.cpp
  4. +6 −20 Port-win32/WinService.cpp
  5. +5 −2 SrvAddrMgr/SrvAddrMgr.cpp
  6. +5 −2 SrvAddrMgr/SrvAddrMgr.h
  7. +11 −9 SrvOptions/SrvOptIA_NA.cpp
  8. +1 −2 WILD-IDEAS
View
7 AddrMgr/AddrIA.cpp
@@ -6,9 +6,12 @@
*
* released under GNU GPL v2 or later licence
*
- * $Id: AddrIA.cpp,v 1.5 2004-06-04 19:03:46 thomson Exp $
+ * $Id: AddrIA.cpp,v 1.6 2004-06-21 23:08:48 thomson Exp $
*
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2004/06/04 19:03:46 thomson
+ * Resolved warnings with signed/unisigned
+ *
* Revision 1.4 2004/03/29 22:06:49 thomson
* 0.1.1 version
*
@@ -185,7 +188,7 @@ int TAddrIA::delAddr(SmartPtr<TIPv6Addr> addr)
return 0;
}
}
- return 0; //FIXME
+ return -1;
}
int TAddrIA::getAddrCount()
View
2 CHANGELOG
@@ -10,6 +10,8 @@
- Doc: Now it is a real documentation
- Srv: class-max-lease, iface-max-lease parameters added
- Client: config file logic changed, no-config is no longer needed.
+ - Client: No more stupid "Interface is loopback, down, not multicast-capable or
+ not present in the system" message.
- Linux: build process rewritten
0.1.1
View
47 Messages/Msg.cpp
@@ -85,7 +85,6 @@ bool TMsg::check()
void TMsg::send()
{
- //FIXME:what the hell means this is not initialized pointer
char *tmppkt = this->pkt;
*(tmppkt++) = (char)MsgType;
@@ -99,54 +98,42 @@ void TMsg::send()
Option->storeSelf(tmppkt);
tmppkt += Option->getSize();
}
+}
-
- // FIXME: So we have constructed a message. Should we send it?
+SmartPtr<TOpt> TMsg::getOption(int type) {
+ SmartPtr<TOpt> Option;
+
+ Options.first();
+ while ( Option = Options.get() ) {
+ if (Option->getOptType()==type)
+ return Option;
+ }
+ return SmartPtr<TOpt>();
}
-SmartPtr<TOpt> TMsg::getOption(int type)
-{
- SmartPtr<TOpt> Option;
-
- Options.first();
- while ( Option = Options.get() )
- {
- if (Option->getOptType()==type)
- return Option;
- }
- return SmartPtr<TOpt>();
-}
-
-void TMsg::firstOption()
-{
+void TMsg::firstOption() {
Options.first();
}
-int TMsg::countOption()
-{
+int TMsg::countOption() {
return Options.count();
}
-SmartPtr<TOpt> TMsg::getOption()
-{
+SmartPtr<TOpt> TMsg::getOption() {
return Options.get();
}
-TMsg::~TMsg()
-{
+TMsg::~TMsg() {
}
-SmartPtr<TIPv6Addr> TMsg::getAddr()
-{
+SmartPtr<TIPv6Addr> TMsg::getAddr() {
return PeerAddr;
}
-int TMsg::getIface()
-{
+int TMsg::getIface() {
return this->Iface;
}
-bool TMsg::isDone()
-{
+bool TMsg::isDone() {
return IsDone;
}
View
26 Port-win32/WinService.cpp
@@ -6,9 +6,12 @@
*
* Released under GNU GPL v2 licence
*
- * $Id: WinService.cpp,v 1.7 2004-05-24 21:16:37 thomson Exp $
+ * $Id: WinService.cpp,v 1.8 2004-06-21 23:08:49 thomson Exp $
*
* $Log: not supported by cvs2svn $
+ * Revision 1.7 2004/05/24 21:16:37 thomson
+ * Various fixes.
+ *
* Revision 1.6 2004/04/15 23:53:45 thomson
* Pathname installation fixed, run-time error checks disabled, winXP code cleanup.
*
@@ -59,13 +62,11 @@ void TWinService::ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv)
// Get a pointer to the C++ object
TWinService* pService = ServicePtr;
- //FIXME:pService->DebugMsg("Entering CNTService::ServiceMain()");
// Register the control request handler
pService->Status.dwCurrentState = SERVICE_START_PENDING;
pService->hServiceStatus = RegisterServiceCtrlHandler(pService->ServiceName,Handler);
if (pService->hServiceStatus==NULL)
{
- //FIXME:pService->LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_CTRLHANDLERNOTINSTALLED);
return;
}
// Start the initialisation
@@ -81,21 +82,18 @@ void TWinService::ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv)
}
// Tell the service manager we are stopped
pService->SetStatus(SERVICE_STOPPED);
- //FIXME:pService->DebugMsg("Leaving CNTService::ServiceMain()");
}
void TWinService::Handler(DWORD dwOpcode) {
//DebugBreak();
// Get a pointer to the object
TWinService* pService = ServicePtr;
- //FIXME:pService->DebugMsg("CNTService::Handler(%lu)", dwOpcode);
switch (dwOpcode) {
case SERVICE_CONTROL_STOP: // 1
pService->SetStatus(SERVICE_STOP_PENDING);
pService->OnStop();
pService->IsRunning = FALSE;
- //FIXME:pService->LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_STOPPED);
break;
case SERVICE_CONTROL_PAUSE: // 2
@@ -119,20 +117,15 @@ void TWinService::Handler(DWORD dwOpcode) {
{
if (!pService->OnUserControl(dwOpcode))
{
- //FIXME:pService->LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_BADREQUEST);
}
}
else
{
- //FIXME:pService->LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_BADREQUEST);
}
break;
}
// Report current status
- //FIXME:pService->DebugMsg("Updating status (%lu, %lu)",
- // pService->m_hServiceStatus,
- // pService->m_Status.dwCurrentState);
SetServiceStatus(pService->hServiceStatus, &pService->Status);
}
@@ -265,22 +258,18 @@ bool TWinService::StartService()
{ServiceName, ServiceMain},
{NULL, NULL}
};
- //FIXME:DebugMsg("Calling StartServiceCtrlDispatcher()");
BOOL result = StartServiceCtrlDispatcher(st);
- //FIXME:DebugMsg("Returned from StartServiceCtrlDispatcher()");
- return result?true:false;
+ return result?true:false;
}
void TWinService::SetStatus(DWORD dwState)
{
- //FIXME:DebugMsg("CNTService::SetStatus(%lu, %lu)", m_hServiceStatus, dwState);
Status.dwCurrentState = dwState;
SetServiceStatus(hServiceStatus, &Status);
}
bool TWinService::Initialize()
{
- //FIXME:DebugMsg("Entering CNTService::Initialize()");
// Start the initialization
SetStatus(SERVICE_START_PENDING);
// Perform the actual initialization
@@ -290,13 +279,10 @@ bool TWinService::Initialize()
Status.dwCheckPoint = 0;
Status.dwWaitHint = 0;
if (!result) {
- //FIXME:LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_FAILEDINIT);
SetStatus(SERVICE_STOPPED);
return false;
}
- //FIXME:LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_STARTED);
SetStatus(SERVICE_RUNNING);
- //FIXME:DebugMsg("Leaving CNTService::Initialize()");
return true;
}
void TWinService::Run()
@@ -370,4 +356,4 @@ void TWinService::showStatus() {
std::clog << "Dibbler client :" << (clientInstalled?"INSTALLED":"NOT INSTALLED")
<< logger::endl;
std::clog << "Client running: " << (this->isRunning("DHCPv6Client") ? "YES":"NO") << logger::endl;
-}
+}
View
7 SrvAddrMgr/SrvAddrMgr.cpp
@@ -6,9 +6,12 @@
*
* released under GNU GPL v2 or later licence
*
- * $Id: SrvAddrMgr.cpp,v 1.5 2004-06-20 21:00:26 thomson Exp $
+ * $Id: SrvAddrMgr.cpp,v 1.6 2004-06-21 23:08:48 thomson Exp $
*
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2004/06/20 21:00:26 thomson
+ * quiet flag added.
+ *
* Revision 1.4 2004/06/20 19:29:23 thomson
* New address assignment finally works.
*
@@ -171,7 +174,7 @@ bool TSrvAddrMgr::delClntAddr(SmartPtr<TDUID> clntDuid,
/*
* how many addresses does this client have?
*/
-unsigned long TSrvAddrMgr::getAddrCount(SmartPtr<TDUID> duid, int iface)
+unsigned long TSrvAddrMgr::getAddrCount(SmartPtr<TDUID> duid)
{
SmartPtr <TAddrClient> ptrClient;
ClntsLst.first();
View
7 SrvAddrMgr/SrvAddrMgr.h
@@ -6,9 +6,12 @@
*
* released under GNU GPL v2 or later licence
*
- * $Id: SrvAddrMgr.h,v 1.3 2004-06-20 21:00:26 thomson Exp $
+ * $Id: SrvAddrMgr.h,v 1.4 2004-06-21 23:08:48 thomson Exp $
*
* $Log: not supported by cvs2svn $
+ * Revision 1.3 2004/06/20 21:00:26 thomson
+ * quiet flag added.
+ *
* Revision 1.2 2004/06/17 23:53:54 thomson
* Server Address Assignment rewritten.
*
@@ -35,7 +38,7 @@ class TSrvAddrMgr : public TAddrMgr
bool quiet);
// how many addresses does this client have?
- unsigned long getAddrCount(SmartPtr<TDUID> duid, int iface);
+ unsigned long getAddrCount(SmartPtr<TDUID> duid);
void doDuties();
View
20 SrvOptions/SrvOptIA_NA.cpp
@@ -6,9 +6,12 @@
*
* released under GNU GPL v2 or later licence
*
- * $Id: SrvOptIA_NA.cpp,v 1.5 2004-06-20 21:00:45 thomson Exp $
+ * $Id: SrvOptIA_NA.cpp,v 1.6 2004-06-21 23:08:49 thomson Exp $
*
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2004/06/20 21:00:45 thomson
+ * Various fixes.
+ *
* Revision 1.4 2004/06/20 19:29:23 thomson
* New address assignment finally works.
*
@@ -135,16 +138,15 @@ TSrvOptIA_NA::TSrvOptIA_NA(SmartPtr<TSrvAddrMgr> addrMgr, SmartPtr<TSrvCfgMgr>
}
// --- check address counts, how many we've got, how many assigned etc. ---
- unsigned long addrsAssigned;
- unsigned long addrsRequested;
- unsigned long addrsFree;
- unsigned long addrsMax;
+ unsigned long addrsAssigned = 0;
+ unsigned long addrsRequested = 0;
+ unsigned long addrsFree = 0;
+ unsigned long addrsMax = 0;
- addrsAssigned = addrMgr->getAddrCount(clntDuid, iface);
+ addrsAssigned = addrMgr->getAddrCount(clntDuid);
addrsRequested= queryOpt->countAddrs();
addrsFree = this->countFreeAddrsForClient();
addrsMax = cfgMgr->getMaxAddrsPerClient(clntDuid, clntAddr, iface);
- addrsAssigned = 0;
Log(Debug) << "Client got " << addrsAssigned << " addrs, requests for "
<< addrsRequested << ", " << addrsFree << " is free, max. "
@@ -271,7 +273,7 @@ unsigned long TSrvOptIA_NA::countFreeAddrsForClient()
maxAddrs = this->CfgMgr->getMaxAddrsPerClient(this->ClntDuid,
this->ClntAddr,
this->Iface) -
- this->AddrMgr->getAddrCount(this->ClntDuid, this->Iface);
+ this->AddrMgr->getAddrCount(this->ClntDuid);
// FIXME: unsigned long long long int (128bit) type would come in handy here
SmartPtr<TSrvCfgAddrClass> ptrClass;
@@ -292,7 +294,7 @@ unsigned long TSrvOptIA_NA::countFreeAddrsForClient()
}
}
//substract addresses which has been already assigned to this client
- tmpcnt -= this->AddrMgr->getAddrCount(this->ClntDuid, this->Iface);
+ tmpcnt -= this->AddrMgr->getAddrCount(this->ClntDuid);
float bigNumber = this->CfgMgr->getFreeAddrsCount(this->ClntDuid, this->ClntAddr, this->Iface);
if (maxAddrs > bigNumber ) {
View
3 WILD-IDEAS
@@ -1,5 +1,5 @@
- WILD IDEAS $Id: WILD-IDEAS,v 1.6 2004-06-05 23:38:08 thomson Exp $
+ WILD IDEAS $Id: WILD-IDEAS,v 1.7 2004-06-21 23:08:48 thomson Exp $
------------
This file contains various ideas and concepts which are not yet approved.
@@ -10,4 +10,3 @@
pointer to my handler". When system receives an option, looks in option table.
If it finds appropriate handler, it passes nessesary data (4xMgr, parent-option ptr,
msg ptr). If not, drops this option.
-- interoperability: is IA without IAADDR (received from client) legal?

0 comments on commit 503ca2c

Please sign in to comment.