Style cleanup, patch by Vasilis Kaoutsis - thanks!

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-03-27 00:14:30 +00:00
parent a71744ba3a
commit fc1cf1a3d2
21 changed files with 872 additions and 853 deletions
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -53,7 +53,7 @@ status_t
KPPPDevice::Control(uint32 op, void *data, size_t length) KPPPDevice::Control(uint32 op, void *data, size_t length)
{ {
switch (op) { switch (op) {
case PPPC_GET_DEVICE_INFO: { case PPPC_GET_DEVICE_INFO:
if (length < sizeof(ppp_device_info_t) || !data) if (length < sizeof(ppp_device_info_t) || !data)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -66,7 +66,7 @@ KPPPDevice::Control(uint32 op, void *data, size_t length)
info->outputTransferRate = OutputTransferRate(); info->outputTransferRate = OutputTransferRate();
info->outputBytesCount = CountOutputBytes(); info->outputBytesCount = CountOutputBytes();
info->isUp = IsUp(); info->isUp = IsUp();
} break; break;
default: default:
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -77,9 +77,9 @@ status_t interface_deleter_thread(void *data);
\param parent (Optional): Interface's parent (only used for multilink interfaces). \param parent (Optional): Interface's parent (only used for multilink interfaces).
*/ */
KPPPInterface::KPPPInterface(const char *name, ppp_interface_entry *entry, KPPPInterface::KPPPInterface(const char *name, ppp_interface_entry *entry,
ppp_interface_id ID, const driver_settings *settings, ppp_interface_id ID, const driver_settings *settings, KPPPInterface *parent)
KPPPInterface *parent) :
: KPPPLayer(name, PPP_INTERFACE_LEVEL, 2), KPPPLayer(name, PPP_INTERFACE_LEVEL, 2),
fID(ID), fID(ID),
fSettings(NULL), fSettings(NULL),
fIfnet(NULL), fIfnet(NULL),
@@ -407,7 +407,8 @@ status_t
KPPPInterface::Control(uint32 op, void *data, size_t length) KPPPInterface::Control(uint32 op, void *data, size_t length)
{ {
switch (op) { switch (op) {
case PPPC_GET_INTERFACE_INFO: { case PPPC_GET_INTERFACE_INFO:
{
if (length < sizeof(ppp_interface_info_t) || !data) if (length < sizeof(ppp_interface_info_t) || !data)
return B_ERROR; return B_ERROR;
@@ -447,9 +448,11 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
info->hasDevice = Device(); info->hasDevice = Device();
info->isMultilink = IsMultilink(); info->isMultilink = IsMultilink();
info->hasParent = Parent(); info->hasParent = Parent();
} break; break;
}
case PPPC_SET_USERNAME: { case PPPC_SET_USERNAME:
{
if (!data) if (!data)
return B_ERROR; return B_ERROR;
@@ -460,9 +463,11 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
free(fUsername); free(fUsername);
fUsername = data ? strdup((const char*) data) : strdup(""); fUsername = data ? strdup((const char*) data) : strdup("");
} break; break;
}
case PPPC_SET_PASSWORD: { case PPPC_SET_PASSWORD:
{
if (!data) if (!data)
return B_ERROR; return B_ERROR;
@@ -473,7 +478,8 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
free(fPassword); free(fPassword);
fPassword = data ? strdup((const char*) data) : strdup(""); fPassword = data ? strdup((const char*) data) : strdup("");
} break; break;
}
case PPPC_SET_ASK_BEFORE_CONNECTING: case PPPC_SET_ASK_BEFORE_CONNECTING:
if (length < sizeof(uint32) || !data) if (length < sizeof(uint32) || !data)
@@ -513,7 +519,8 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return B_ERROR; return B_ERROR;
break; break;
case PPPC_ENABLE_REPORTS: { case PPPC_ENABLE_REPORTS:
{
if (length < sizeof(ppp_report_request) || !data) if (length < sizeof(ppp_report_request) || !data)
return B_ERROR; return B_ERROR;
@@ -531,24 +538,28 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
} }
ReportManager().EnableReports(request->type, request->thread, ReportManager().EnableReports(request->type, request->thread,
request->flags); request->flags);
} break; break;
}
case PPPC_DISABLE_REPORTS: { case PPPC_DISABLE_REPORTS:
{
if (length < sizeof(ppp_report_request) || !data) if (length < sizeof(ppp_report_request) || !data)
return B_ERROR; return B_ERROR;
ppp_report_request *request = (ppp_report_request*) data; ppp_report_request *request = (ppp_report_request*) data;
ReportManager().DisableReports(request->type, request->thread); ReportManager().DisableReports(request->type, request->thread);
} break; break;
}
case PPPC_GET_STATISTICS: { case PPPC_GET_STATISTICS:
if (length < sizeof(ppp_statistics) || !data) if (length < sizeof(ppp_statistics) || !data)
return B_ERROR; return B_ERROR;
memcpy(data, &fStatistics, sizeof(ppp_statistics)); memcpy(data, &fStatistics, sizeof(ppp_statistics));
} break; break;
case PPPC_CONTROL_DEVICE: { case PPPC_CONTROL_DEVICE:
{
if (length < sizeof(ppp_control_info) || !data) if (length < sizeof(ppp_control_info) || !data)
return B_ERROR; return B_ERROR;
@@ -557,9 +568,10 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return B_BAD_INDEX; return B_BAD_INDEX;
return Device()->Control(control->op, control->data, control->length); return Device()->Control(control->op, control->data, control->length);
} break; }
case PPPC_CONTROL_PROTOCOL: { case PPPC_CONTROL_PROTOCOL:
{
if (length < sizeof(ppp_control_info) || !data) if (length < sizeof(ppp_control_info) || !data)
return B_ERROR; return B_ERROR;
@@ -569,9 +581,10 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return B_BAD_INDEX; return B_BAD_INDEX;
return protocol->Control(control->op, control->data, control->length); return protocol->Control(control->op, control->data, control->length);
} break; }
case PPPC_CONTROL_OPTION_HANDLER: { case PPPC_CONTROL_OPTION_HANDLER:
{
if (length < sizeof(ppp_control_info) || !data) if (length < sizeof(ppp_control_info) || !data)
return B_ERROR; return B_ERROR;
@@ -582,9 +595,10 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return optionHandler->Control(control->op, control->data, return optionHandler->Control(control->op, control->data,
control->length); control->length);
} break; }
case PPPC_CONTROL_LCP_EXTENSION: { case PPPC_CONTROL_LCP_EXTENSION:
{
if (length < sizeof(ppp_control_info) || !data) if (length < sizeof(ppp_control_info) || !data)
return B_ERROR; return B_ERROR;
@@ -595,9 +609,10 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return lcpExtension->Control(control->op, control->data, return lcpExtension->Control(control->op, control->data,
control->length); control->length);
} break; }
case PPPC_CONTROL_CHILD: { case PPPC_CONTROL_CHILD:
{
if (length < sizeof(ppp_control_info) || !data) if (length < sizeof(ppp_control_info) || !data)
return B_ERROR; return B_ERROR;
@@ -607,7 +622,7 @@ KPPPInterface::Control(uint32 op, void *data, size_t length)
return B_BAD_INDEX; return B_BAD_INDEX;
return child->Control(control->op, control->data, control->length); return child->Control(control->op, control->data, control->length);
} break; }
default: default:
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -26,7 +26,8 @@
//! Creates a new LCP protocol for the given interface. //! Creates a new LCP protocol for the given interface.
KPPPLCP::KPPPLCP(KPPPInterface& interface) KPPPLCP::KPPPLCP(KPPPInterface& interface)
: KPPPProtocol("LCP", PPP_ESTABLISHMENT_PHASE, PPP_LCP_PROTOCOL, :
KPPPProtocol("LCP", PPP_ESTABLISHMENT_PHASE, PPP_LCP_PROTOCOL,
PPP_PROTOCOL_LEVEL, AF_UNSPEC, 0, interface, NULL, PPP_ALWAYS_ALLOWED), PPP_PROTOCOL_LEVEL, AF_UNSPEC, 0, interface, NULL, PPP_ALWAYS_ALLOWED),
fStateMachine(interface.StateMachine()), fStateMachine(interface.StateMachine()),
fTarget(NULL) fTarget(NULL)
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -10,7 +10,6 @@
*/ */
#include <KPPPLCPExtension.h> #include <KPPPLCPExtension.h>
#include <PPPControl.h> #include <PPPControl.h>
@@ -60,7 +59,8 @@ status_t
KPPPLCPExtension::Control(uint32 op, void *data, size_t length) KPPPLCPExtension::Control(uint32 op, void *data, size_t length)
{ {
switch (op) { switch (op) {
case PPPC_GET_SIMPLE_HANDLER_INFO: { case PPPC_GET_SIMPLE_HANDLER_INFO:
{
if (length < sizeof(ppp_simple_handler_info_t) || !data) if (length < sizeof(ppp_simple_handler_info_t) || !data)
return B_ERROR; return B_ERROR;
@@ -69,7 +69,8 @@ KPPPLCPExtension::Control(uint32 op, void *data, size_t length)
if (Name()) if (Name())
strncpy(info->name, Name(), PPP_HANDLER_NAME_LENGTH_LIMIT); strncpy(info->name, Name(), PPP_HANDLER_NAME_LENGTH_LIMIT);
info->isEnabled = IsEnabled(); info->isEnabled = IsEnabled();
} break; break;
}
case PPPC_ENABLE: case PPPC_ENABLE:
if (length < sizeof(uint32) || !data) if (length < sizeof(uint32) || !data)
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -25,7 +25,8 @@
*/ */
KPPPOptionHandler::KPPPOptionHandler(const char *name, uint8 type, KPPPOptionHandler::KPPPOptionHandler(const char *name, uint8 type,
KPPPInterface& interface, driver_parameter *settings) KPPPInterface& interface, driver_parameter *settings)
: fInitStatus(B_OK), :
fInitStatus(B_OK),
fType(type), fType(type),
fInterface(interface), fInterface(interface),
fSettings(settings), fSettings(settings),
@@ -60,7 +61,8 @@ status_t
KPPPOptionHandler::Control(uint32 op, void *data, size_t length) KPPPOptionHandler::Control(uint32 op, void *data, size_t length)
{ {
switch (op) { switch (op) {
case PPPC_GET_SIMPLE_HANDLER_INFO: { case PPPC_GET_SIMPLE_HANDLER_INFO:
{
if (length < sizeof(ppp_simple_handler_info_t) || !data) if (length < sizeof(ppp_simple_handler_info_t) || !data)
return B_ERROR; return B_ERROR;
@@ -69,7 +71,8 @@ KPPPOptionHandler::Control(uint32 op, void *data, size_t length)
if (Name()) if (Name())
strncpy(info->name, Name(), PPP_HANDLER_NAME_LENGTH_LIMIT); strncpy(info->name, Name(), PPP_HANDLER_NAME_LENGTH_LIMIT);
info->isEnabled = IsEnabled(); info->isEnabled = IsEnabled();
} break; break;
}
case PPPC_ENABLE: case PPPC_ENABLE:
if (length < sizeof(uint32) || !data) if (length < sizeof(uint32) || !data)
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -43,7 +43,8 @@ KPPPProtocol::KPPPProtocol(const char *name, ppp_phase activationPhase,
uint32 overhead, KPPPInterface& interface, uint32 overhead, KPPPInterface& interface,
driver_parameter *settings, int32 flags, driver_parameter *settings, int32 flags,
const char *type, KPPPOptionHandler *optionHandler) const char *type, KPPPOptionHandler *optionHandler)
: KPPPLayer(name, level, overhead), :
KPPPLayer(name, level, overhead),
fActivationPhase(activationPhase), fActivationPhase(activationPhase),
fProtocolNumber(protocolNumber), fProtocolNumber(protocolNumber),
fAddressFamily(addressFamily), fAddressFamily(addressFamily),
@@ -77,7 +78,6 @@ KPPPProtocol::KPPPProtocol(const char *name, ppp_phase activationPhase,
KPPPProtocol::~KPPPProtocol() KPPPProtocol::~KPPPProtocol()
{ {
Interface().RemoveProtocol(this); Interface().RemoveProtocol(this);
free(fType); free(fType);
} }
@@ -101,7 +101,8 @@ status_t
KPPPProtocol::Control(uint32 op, void *data, size_t length) KPPPProtocol::Control(uint32 op, void *data, size_t length)
{ {
switch (op) { switch (op) {
case PPPC_GET_PROTOCOL_INFO: { case PPPC_GET_PROTOCOL_INFO:
{
if (length < sizeof(ppp_protocol_info_t) || !data) if (length < sizeof(ppp_protocol_info_t) || !data)
return B_ERROR; return B_ERROR;
@@ -121,7 +122,8 @@ KPPPProtocol::Control(uint32 op, void *data, size_t length)
info->protocolNumber = ProtocolNumber(); info->protocolNumber = ProtocolNumber();
info->isEnabled = IsEnabled(); info->isEnabled = IsEnabled();
info->isUpRequested = IsUpRequested(); info->isUpRequested = IsUpRequested();
} break; break;
}
case PPPC_ENABLE: case PPPC_ENABLE:
if (length < sizeof(uint32) || !data) if (length < sizeof(uint32) || !data)
@@ -207,7 +209,6 @@ void
KPPPProtocol::UpFailedEvent() KPPPProtocol::UpFailedEvent()
{ {
fConnectionPhase = PPP_DOWN_PHASE; fConnectionPhase = PPP_DOWN_PHASE;
Interface().StateMachine().UpFailedEvent(this); Interface().StateMachine().UpFailedEvent(this);
} }
@@ -220,7 +221,6 @@ void
KPPPProtocol::UpEvent() KPPPProtocol::UpEvent()
{ {
fConnectionPhase = PPP_ESTABLISHED_PHASE; fConnectionPhase = PPP_ESTABLISHED_PHASE;
Interface().StateMachine().UpEvent(this); Interface().StateMachine().UpEvent(this);
} }
@@ -233,6 +233,5 @@ void
KPPPProtocol::DownEvent() KPPPProtocol::DownEvent()
{ {
fConnectionPhase = PPP_DOWN_PHASE; fConnectionPhase = PPP_DOWN_PHASE;
Interface().StateMachine().DownEvent(this); Interface().StateMachine().DownEvent(this);
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <[email protected]> * Copyright 2003-2007, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2004-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> * Copyright 2003-2007, Waldemar Kornewald <wkornew@gmx.net>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */