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:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user