Style changes

whitespaces remaining... what editor do you use to avoid that?



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-12-01 23:09:11 +00:00
parent 5b7fde0fb5
commit a94c1dc58d
4 changed files with 74 additions and 67 deletions
@@ -1,15 +1,23 @@
/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com
*/
#include "L2capEndpoint.h" #include "L2capEndpoint.h"
#include "l2cap_address.h"
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include "l2cap_address.h"
#include <bluetooth/L2CAP/btL2CAP.h> #include <bluetooth/L2CAP/btL2CAP.h>
#define BT_DEBUG_THIS_MODULE #define BT_DEBUG_THIS_MODULE
#include <btDebug.h> #include <btDebug.h>
static inline bigtime_t static inline bigtime_t
absolute_timeout(bigtime_t timeout) absolute_timeout(bigtime_t timeout)
{ {
@@ -58,7 +66,7 @@ L2capEndpoint::Init()
{ {
debugf("[%ld] %p->L2capEndpoint::Init()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Init()\n", find_thread(NULL), this);
return(B_OK); return B_OK;
} }
@@ -67,7 +75,6 @@ L2capEndpoint::Uninit()
{ {
debugf("[%ld] %p->L2capEndpoint::Uninit()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Uninit()\n", find_thread(NULL), this);
} }
@@ -78,11 +85,9 @@ L2capEndpoint::Open()
status_t error = ProtocolSocket::Open(); status_t error = ProtocolSocket::Open();
if (error != B_OK) if (error != B_OK)
return(error); return error;
return B_OK;
return(B_OK);
} }
@@ -91,7 +96,7 @@ L2capEndpoint::Close()
{ {
debugf("[%ld] %p->L2capEndpoint::Close()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Close()\n", find_thread(NULL), this);
return(B_OK); return B_OK;
} }
@@ -100,7 +105,7 @@ L2capEndpoint::Free()
{ {
debugf("[%ld] %p->L2capEndpoint::Free()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Free()\n", find_thread(NULL), this);
return(B_OK); return B_OK;
} }
@@ -111,7 +116,7 @@ L2capEndpoint::Bind(const struct sockaddr *_address)
panic("null adrresss!"); panic("null adrresss!");
if (_address->sa_family != AF_BLUETOOTH ) if (_address->sa_family != AF_BLUETOOTH )
return(EAFNOSUPPORT); return EAFNOSUPPORT;
// TODO: Check socladdr_l2cap size // TODO: Check socladdr_l2cap size
@@ -144,7 +149,7 @@ L2capEndpoint::Unbind()
{ {
debugf("[%ld] %p->L2capEndpoint::Unbind()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Unbind()\n", find_thread(NULL), this);
return(B_OK); return B_OK;
} }
@@ -168,7 +173,7 @@ status_t
L2capEndpoint::Connect(const struct sockaddr *_address) L2capEndpoint::Connect(const struct sockaddr *_address)
{ {
if (_address->sa_family != AF_BLUETOOTH) if (_address->sa_family != AF_BLUETOOTH)
return(EAFNOSUPPORT); return EAFNOSUPPORT;
debugf("[%ld] %p->L2capEndpoint::Connect(\"%s\")\n", find_thread(NULL), this, debugf("[%ld] %p->L2capEndpoint::Connect(\"%s\")\n", find_thread(NULL), this,
ConstSocketAddress(&gL2cap4AddressModule, _address).AsString().Data()); ConstSocketAddress(&gL2cap4AddressModule, _address).AsString().Data());
@@ -232,7 +237,6 @@ L2capEndpoint::Sendable()
{ {
debugf("[%ld] %p->L2capEndpoint::Sendable()\n", find_thread(NULL), this); debugf("[%ld] %p->L2capEndpoint::Sendable()\n", find_thread(NULL), this);
return 0; return 0;
} }
@@ -257,8 +261,8 @@ L2capEndpoint::ForPsm(uint16 psm)
while (iterator.HasNext()) { while (iterator.HasNext()) {
endpoint = iterator.Next(); endpoint = iterator.Next();
if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm && if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm
endpoint->fState == LISTEN) { && endpoint->fState == LISTEN) {
// TODO endpoint ocupied, lock it! define a channel for it // TODO endpoint ocupied, lock it! define a channel for it
return endpoint; return endpoint;
} }
@@ -1,7 +1,13 @@
/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com
*/
#ifndef L2CAP_ENDPOINT_H #ifndef L2CAP_ENDPOINT_H
#define L2CAP_ENDPOINT_H #define L2CAP_ENDPOINT_H
#include <sys/stat.h> #include <sys/stat.h>
#include <lock.h> #include <lock.h>
@@ -18,8 +24,7 @@ extern net_stack_module_info* gStackModule;
class L2capEndpoint : public net_protocol, class L2capEndpoint : public net_protocol,
public ProtocolSocket, public ProtocolSocket,
public DoublyLinkedListLinkImpl<L2capEndpoint> public DoublyLinkedListLinkImpl<L2capEndpoint> {
{
public: public:
L2capEndpoint(net_socket* socket); L2capEndpoint(net_socket* socket);
@@ -102,4 +107,4 @@ private:
extern DoublyLinkedList<L2capEndpoint> EndpointList; extern DoublyLinkedList<L2capEndpoint> EndpointList;
#endif // L2cap_ENDPOINT_H #endif // L2CAP_ENDPOINT_H
@@ -51,16 +51,16 @@ DoublyLinkedList<L2capEndpoint> EndpointList;
extern net_protocol_module_info gL2CAPModule; extern net_protocol_module_info gL2CAPModule;
// module references // module references
bluetooth_core_data_module_info *btCoreData; bluetooth_core_data_module_info* btCoreData;
net_buffer_module_info *gBufferModule; net_buffer_module_info* gBufferModule;
net_stack_module_info *gStackModule; net_stack_module_info* gStackModule;
net_socket_module_info *gSocketModule; net_socket_module_info* gSocketModule;
static struct net_domain *sDomain; static struct net_domain* sDomain;
net_protocol * net_protocol*
l2cap_init_protocol(net_socket *socket) l2cap_init_protocol(net_socket* socket)
{ {
flowf("\n"); flowf("\n");
@@ -75,7 +75,7 @@ l2cap_init_protocol(net_socket *socket)
status_t status_t
l2cap_uninit_protocol(net_protocol *protocol) l2cap_uninit_protocol(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -88,7 +88,7 @@ l2cap_uninit_protocol(net_protocol *protocol)
status_t status_t
l2cap_open(net_protocol *protocol) l2cap_open(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -97,7 +97,7 @@ l2cap_open(net_protocol *protocol)
status_t status_t
l2cap_close(net_protocol *protocol) l2cap_close(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -106,7 +106,7 @@ l2cap_close(net_protocol *protocol)
status_t status_t
l2cap_free(net_protocol *protocol) l2cap_free(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -115,7 +115,7 @@ l2cap_free(net_protocol *protocol)
status_t status_t
l2cap_connect(net_protocol *protocol, const struct sockaddr *address) l2cap_connect(net_protocol* protocol, const struct sockaddr* address)
{ {
flowf("\n"); flowf("\n");
@@ -124,7 +124,7 @@ l2cap_connect(net_protocol *protocol, const struct sockaddr *address)
status_t status_t
l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket) l2cap_accept(net_protocol* protocol, struct net_socket** _acceptedSocket)
{ {
flowf("\n"); flowf("\n");
@@ -133,8 +133,8 @@ l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket)
status_t status_t
l2cap_control(net_protocol *protocol, int level, int option, void *value, l2cap_control(net_protocol* protocol, int level, int option, void* value,
size_t *_length) size_t* _length)
{ {
flowf("\n"); flowf("\n");
@@ -144,8 +144,8 @@ l2cap_control(net_protocol *protocol, int level, int option, void *value,
status_t status_t
l2cap_getsockopt(net_protocol *protocol, int level, int option, l2cap_getsockopt(net_protocol* protocol, int level, int option,
void *value, int *length) void* value, int* length)
{ {
flowf("\n"); flowf("\n");
@@ -155,8 +155,8 @@ l2cap_getsockopt(net_protocol *protocol, int level, int option,
status_t status_t
l2cap_setsockopt(net_protocol *protocol, int level, int option, l2cap_setsockopt(net_protocol* protocol, int level, int option,
const void *value, int length) const void* value, int length)
{ {
flowf("\n"); flowf("\n");
@@ -175,7 +175,7 @@ l2cap_bind(net_protocol* protocol, const struct sockaddr* address)
status_t status_t
l2cap_unbind(net_protocol *protocol, struct sockaddr *address) l2cap_unbind(net_protocol* protocol, struct sockaddr* address)
{ {
flowf("\n"); flowf("\n");
@@ -184,14 +184,14 @@ l2cap_unbind(net_protocol *protocol, struct sockaddr *address)
status_t status_t
l2cap_listen(net_protocol *protocol, int count) l2cap_listen(net_protocol* protocol, int count)
{ {
return ((L2capEndpoint*)protocol)->Listen(count); return ((L2capEndpoint*)protocol)->Listen(count);
} }
status_t status_t
l2cap_shutdown(net_protocol *protocol, int direction) l2cap_shutdown(net_protocol* protocol, int direction)
{ {
flowf("\n"); flowf("\n");
@@ -200,7 +200,7 @@ l2cap_shutdown(net_protocol *protocol, int direction)
status_t status_t
l2cap_send_data(net_protocol *protocol, net_buffer *buffer) l2cap_send_data(net_protocol* protocol, net_buffer* buffer)
{ {
flowf("\n"); flowf("\n");
@@ -209,8 +209,8 @@ l2cap_send_data(net_protocol *protocol, net_buffer *buffer)
status_t status_t
l2cap_send_routed_data(net_protocol *protocol, struct net_route *route, l2cap_send_routed_data(net_protocol* protocol, struct net_route* route,
net_buffer *buffer) net_buffer* buffer)
{ {
flowf("\n"); flowf("\n");
@@ -219,7 +219,7 @@ l2cap_send_routed_data(net_protocol *protocol, struct net_route *route,
ssize_t ssize_t
l2cap_send_avail(net_protocol *protocol) l2cap_send_avail(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -228,8 +228,8 @@ l2cap_send_avail(net_protocol *protocol)
status_t status_t
l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags, l2cap_read_data(net_protocol* protocol, size_t numBytes, uint32 flags,
net_buffer **_buffer) net_buffer** _buffer)
{ {
flowf("\n"); flowf("\n");
@@ -238,7 +238,7 @@ l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags,
ssize_t ssize_t
l2cap_read_avail(net_protocol *protocol) l2cap_read_avail(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -246,8 +246,8 @@ l2cap_read_avail(net_protocol *protocol)
} }
struct net_domain * struct net_domain*
l2cap_get_domain(net_protocol *protocol) l2cap_get_domain(net_protocol* protocol)
{ {
flowf("\n"); flowf("\n");
@@ -256,7 +256,7 @@ l2cap_get_domain(net_protocol *protocol)
size_t size_t
l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address) l2cap_get_mtu(net_protocol* protocol, const struct sockaddr* address)
{ {
flowf("\n"); flowf("\n");
@@ -265,9 +265,9 @@ l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address)
status_t status_t
l2cap_receive_data(net_buffer *buffer) l2cap_receive_data(net_buffer* buffer)
{ {
HciConnection* conn = (HciConnection*) buffer; HciConnection* conn = (HciConnection*)buffer;
debugf("received some data, buffer length %lu\n", conn->currentRxPacket->size); debugf("received some data, buffer length %lu\n", conn->currentRxPacket->size);
l2cap_receive(conn, conn->currentRxPacket); l2cap_receive(conn, conn->currentRxPacket);
@@ -277,7 +277,7 @@ l2cap_receive_data(net_buffer *buffer)
status_t status_t
l2cap_error(uint32 code, net_buffer *data) l2cap_error(uint32 code, net_buffer* data)
{ {
flowf("\n"); flowf("\n");
@@ -286,8 +286,8 @@ l2cap_error(uint32 code, net_buffer *data)
status_t status_t
l2cap_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code, l2cap_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
void *errorData) void* errorData)
{ {
flowf("\n"); flowf("\n");
@@ -384,14 +384,14 @@ net_protocol_module_info gL2CAPModule = {
}; };
module_dependency module_dependencies[] = { module_dependency module_dependencies[] = {
{NET_STACK_MODULE_NAME, (module_info **)&gStackModule}, {NET_STACK_MODULE_NAME, (module_info**)&gStackModule},
{NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule}, {NET_BUFFER_MODULE_NAME, (module_info**)&gBufferModule},
{BT_CORE_DATA_MODULE_NAME, (module_info **)&btCoreData}, {BT_CORE_DATA_MODULE_NAME, (module_info**)&btCoreData},
{NET_SOCKET_MODULE_NAME, (module_info **)&gSocketModule}, {NET_SOCKET_MODULE_NAME, (module_info**)&gSocketModule},
{} {}
}; };
module_info *modules[] = { module_info* modules[] = {
(module_info *)&gL2CAPModule, (module_info*)&gL2CAPModule,
NULL NULL
}; };
@@ -1,12 +1,10 @@
/* /*
* Copyright 2006, Haiku, Inc. All Rights Reserved. * Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com * Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com
*/ */
#ifndef L2CAP_ADDRESS_H #ifndef L2CAP_ADDRESS_H
#define L2CAP_ADDRESS_H #define L2CAP_ADDRESS_H