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:
parent
5b7fde0fb5
commit
a94c1dc58d
@ -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 "l2cap_address.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "l2cap_address.h"
|
||||
|
||||
#include <bluetooth/L2CAP/btL2CAP.h>
|
||||
#define BT_DEBUG_THIS_MODULE
|
||||
#include <btDebug.h>
|
||||
|
||||
|
||||
static inline bigtime_t
|
||||
absolute_timeout(bigtime_t timeout)
|
||||
{
|
||||
@ -58,7 +66,7 @@ L2capEndpoint::Init()
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -76,13 +83,11 @@ L2capEndpoint::Open()
|
||||
{
|
||||
debugf("[%ld] %p->L2capEndpoint::Open()\n", find_thread(NULL), this);
|
||||
|
||||
status_t error = ProtocolSocket::Open();
|
||||
status_t error = ProtocolSocket::Open();
|
||||
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);
|
||||
|
||||
return(B_OK);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +105,7 @@ L2capEndpoint::Free()
|
||||
{
|
||||
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!");
|
||||
|
||||
if (_address->sa_family != AF_BLUETOOTH )
|
||||
return(EAFNOSUPPORT);
|
||||
return EAFNOSUPPORT;
|
||||
|
||||
// TODO: Check socladdr_l2cap size
|
||||
|
||||
@ -144,7 +149,7 @@ L2capEndpoint::Unbind()
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (_address->sa_family != AF_BLUETOOTH)
|
||||
return(EAFNOSUPPORT);
|
||||
return EAFNOSUPPORT;
|
||||
|
||||
debugf("[%ld] %p->L2capEndpoint::Connect(\"%s\")\n", find_thread(NULL), this,
|
||||
ConstSocketAddress(&gL2cap4AddressModule, _address).AsString().Data());
|
||||
@ -232,7 +237,6 @@ L2capEndpoint::Sendable()
|
||||
{
|
||||
debugf("[%ld] %p->L2capEndpoint::Sendable()\n", find_thread(NULL), this);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -257,8 +261,8 @@ L2capEndpoint::ForPsm(uint16 psm)
|
||||
while (iterator.HasNext()) {
|
||||
|
||||
endpoint = iterator.Next();
|
||||
if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm &&
|
||||
endpoint->fState == LISTEN) {
|
||||
if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm
|
||||
&& endpoint->fState == LISTEN) {
|
||||
// TODO endpoint ocupied, lock it! define a channel for it
|
||||
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
|
||||
#define L2CAP_ENDPOINT_H
|
||||
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <lock.h>
|
||||
@ -18,8 +24,7 @@ extern net_stack_module_info* gStackModule;
|
||||
|
||||
class L2capEndpoint : public net_protocol,
|
||||
public ProtocolSocket,
|
||||
public DoublyLinkedListLinkImpl<L2capEndpoint>
|
||||
{
|
||||
public DoublyLinkedListLinkImpl<L2capEndpoint> {
|
||||
|
||||
public:
|
||||
L2capEndpoint(net_socket* socket);
|
||||
@ -102,4 +107,4 @@ private:
|
||||
|
||||
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;
|
||||
|
||||
// module references
|
||||
bluetooth_core_data_module_info *btCoreData;
|
||||
bluetooth_core_data_module_info* btCoreData;
|
||||
|
||||
net_buffer_module_info *gBufferModule;
|
||||
net_stack_module_info *gStackModule;
|
||||
net_socket_module_info *gSocketModule;
|
||||
net_buffer_module_info* gBufferModule;
|
||||
net_stack_module_info* gStackModule;
|
||||
net_socket_module_info* gSocketModule;
|
||||
|
||||
static struct net_domain *sDomain;
|
||||
static struct net_domain* sDomain;
|
||||
|
||||
net_protocol *
|
||||
l2cap_init_protocol(net_socket *socket)
|
||||
net_protocol*
|
||||
l2cap_init_protocol(net_socket* socket)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -75,7 +75,7 @@ l2cap_init_protocol(net_socket *socket)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_uninit_protocol(net_protocol *protocol)
|
||||
l2cap_uninit_protocol(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -88,7 +88,7 @@ l2cap_uninit_protocol(net_protocol *protocol)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_open(net_protocol *protocol)
|
||||
l2cap_open(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -97,7 +97,7 @@ l2cap_open(net_protocol *protocol)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_close(net_protocol *protocol)
|
||||
l2cap_close(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -106,7 +106,7 @@ l2cap_close(net_protocol *protocol)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_free(net_protocol *protocol)
|
||||
l2cap_free(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -115,7 +115,7 @@ l2cap_free(net_protocol *protocol)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_connect(net_protocol *protocol, const struct sockaddr *address)
|
||||
l2cap_connect(net_protocol* protocol, const struct sockaddr* address)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -124,7 +124,7 @@ l2cap_connect(net_protocol *protocol, const struct sockaddr *address)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket)
|
||||
l2cap_accept(net_protocol* protocol, struct net_socket** _acceptedSocket)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -133,8 +133,8 @@ l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_control(net_protocol *protocol, int level, int option, void *value,
|
||||
size_t *_length)
|
||||
l2cap_control(net_protocol* protocol, int level, int option, void* value,
|
||||
size_t* _length)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -144,8 +144,8 @@ l2cap_control(net_protocol *protocol, int level, int option, void *value,
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_getsockopt(net_protocol *protocol, int level, int option,
|
||||
void *value, int *length)
|
||||
l2cap_getsockopt(net_protocol* protocol, int level, int option,
|
||||
void* value, int* length)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -155,8 +155,8 @@ l2cap_getsockopt(net_protocol *protocol, int level, int option,
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_setsockopt(net_protocol *protocol, int level, int option,
|
||||
const void *value, int length)
|
||||
l2cap_setsockopt(net_protocol* protocol, int level, int option,
|
||||
const void* value, int length)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -175,7 +175,7 @@ l2cap_bind(net_protocol* protocol, const struct sockaddr* address)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_unbind(net_protocol *protocol, struct sockaddr *address)
|
||||
l2cap_unbind(net_protocol* protocol, struct sockaddr* address)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -184,14 +184,14 @@ l2cap_unbind(net_protocol *protocol, struct sockaddr *address)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_listen(net_protocol *protocol, int count)
|
||||
l2cap_listen(net_protocol* protocol, int count)
|
||||
{
|
||||
return ((L2capEndpoint*)protocol)->Listen(count);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_shutdown(net_protocol *protocol, int direction)
|
||||
l2cap_shutdown(net_protocol* protocol, int direction)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -200,7 +200,7 @@ l2cap_shutdown(net_protocol *protocol, int direction)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_send_data(net_protocol *protocol, net_buffer *buffer)
|
||||
l2cap_send_data(net_protocol* protocol, net_buffer* buffer)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -209,8 +209,8 @@ l2cap_send_data(net_protocol *protocol, net_buffer *buffer)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_send_routed_data(net_protocol *protocol, struct net_route *route,
|
||||
net_buffer *buffer)
|
||||
l2cap_send_routed_data(net_protocol* protocol, struct net_route* route,
|
||||
net_buffer* buffer)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -219,7 +219,7 @@ l2cap_send_routed_data(net_protocol *protocol, struct net_route *route,
|
||||
|
||||
|
||||
ssize_t
|
||||
l2cap_send_avail(net_protocol *protocol)
|
||||
l2cap_send_avail(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -228,8 +228,8 @@ l2cap_send_avail(net_protocol *protocol)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags,
|
||||
net_buffer **_buffer)
|
||||
l2cap_read_data(net_protocol* protocol, size_t numBytes, uint32 flags,
|
||||
net_buffer** _buffer)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -238,7 +238,7 @@ l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags,
|
||||
|
||||
|
||||
ssize_t
|
||||
l2cap_read_avail(net_protocol *protocol)
|
||||
l2cap_read_avail(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -246,8 +246,8 @@ l2cap_read_avail(net_protocol *protocol)
|
||||
}
|
||||
|
||||
|
||||
struct net_domain *
|
||||
l2cap_get_domain(net_protocol *protocol)
|
||||
struct net_domain*
|
||||
l2cap_get_domain(net_protocol* protocol)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -256,7 +256,7 @@ l2cap_get_domain(net_protocol *protocol)
|
||||
|
||||
|
||||
size_t
|
||||
l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address)
|
||||
l2cap_get_mtu(net_protocol* protocol, const struct sockaddr* address)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -265,9 +265,9 @@ l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address)
|
||||
|
||||
|
||||
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);
|
||||
|
||||
l2cap_receive(conn, conn->currentRxPacket);
|
||||
@ -277,7 +277,7 @@ l2cap_receive_data(net_buffer *buffer)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_error(uint32 code, net_buffer *data)
|
||||
l2cap_error(uint32 code, net_buffer* data)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -286,8 +286,8 @@ l2cap_error(uint32 code, net_buffer *data)
|
||||
|
||||
|
||||
status_t
|
||||
l2cap_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code,
|
||||
void *errorData)
|
||||
l2cap_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code,
|
||||
void* errorData)
|
||||
{
|
||||
flowf("\n");
|
||||
|
||||
@ -384,14 +384,14 @@ net_protocol_module_info gL2CAPModule = {
|
||||
};
|
||||
|
||||
module_dependency module_dependencies[] = {
|
||||
{NET_STACK_MODULE_NAME, (module_info **)&gStackModule},
|
||||
{NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule},
|
||||
{BT_CORE_DATA_MODULE_NAME, (module_info **)&btCoreData},
|
||||
{NET_SOCKET_MODULE_NAME, (module_info **)&gSocketModule},
|
||||
{NET_STACK_MODULE_NAME, (module_info**)&gStackModule},
|
||||
{NET_BUFFER_MODULE_NAME, (module_info**)&gBufferModule},
|
||||
{BT_CORE_DATA_MODULE_NAME, (module_info**)&btCoreData},
|
||||
{NET_SOCKET_MODULE_NAME, (module_info**)&gSocketModule},
|
||||
{}
|
||||
};
|
||||
|
||||
module_info *modules[] = {
|
||||
(module_info *)&gL2CAPModule,
|
||||
module_info* modules[] = {
|
||||
(module_info*)&gL2CAPModule,
|
||||
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.
|
||||
*
|
||||
* Authors:
|
||||
* Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef L2CAP_ADDRESS_H
|
||||
#define L2CAP_ADDRESS_H
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user