Changeset 28756

Show
Ignore:
Timestamp:
12/01/08 18:09:11 (5 weeks ago)
Author:
oruizdorantes
Message:

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

Location:
haiku/trunk/src/add-ons/kernel/network/protocols/l2cap
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.cpp

    r28738 r28756  
     1/* 
     2 * Copyright 2008, Haiku, Inc. All Rights Reserved. 
     3 * Distributed under the terms of the MIT License. 
     4 * 
     5 * Authors: 
     6 *              Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com 
     7 */ 
    18#include "L2capEndpoint.h" 
     9#include "l2cap_address.h" 
    210 
    311#include <stdio.h> 
     12#include <string.h> 
    413#include <sys/stat.h> 
    5 #include <string.h> 
    6  
    7 #include "l2cap_address.h" 
     14 
    815 
    916#include <bluetooth/L2CAP/btL2CAP.h> 
    1017#define BT_DEBUG_THIS_MODULE 
    1118#include <btDebug.h> 
     19 
    1220 
    1321static inline bigtime_t 
     
    5967        debugf("[%ld] %p->L2capEndpoint::Init()\n", find_thread(NULL), this); 
    6068 
    61         return(B_OK); 
     69        return B_OK; 
    6270} 
    6371 
     
    6876        debugf("[%ld] %p->L2capEndpoint::Uninit()\n", find_thread(NULL), this); 
    6977 
    70  
    7178} 
    7279 
     
    7784        debugf("[%ld] %p->L2capEndpoint::Open()\n", find_thread(NULL), this); 
    7885 
    79     status_t error = ProtocolSocket::Open(); 
     86        status_t error = ProtocolSocket::Open(); 
    8087        if (error != B_OK) 
    81                 return(error); 
    82  
    83  
    84  
    85         return(B_OK); 
     88                return error; 
     89 
     90        return B_OK; 
    8691} 
    8792 
     
    9297        debugf("[%ld] %p->L2capEndpoint::Close()\n", find_thread(NULL), this); 
    9398 
    94         return(B_OK); 
     99        return B_OK; 
    95100} 
    96101 
     
    101106        debugf("[%ld] %p->L2capEndpoint::Free()\n", find_thread(NULL), this); 
    102107 
    103         return(B_OK); 
     108        return B_OK; 
    104109} 
    105110 
     
    112117         
    113118        if (_address->sa_family != AF_BLUETOOTH ) 
    114                 return(EAFNOSUPPORT); 
     119                return EAFNOSUPPORT; 
    115120 
    116121        // TODO: Check socladdr_l2cap size 
     
    145150        debugf("[%ld] %p->L2capEndpoint::Unbind()\n", find_thread(NULL), this); 
    146151 
    147         return(B_OK); 
     152        return B_OK; 
    148153} 
    149154 
     
    169174{ 
    170175        if (_address->sa_family != AF_BLUETOOTH) 
    171                 return(EAFNOSUPPORT); 
     176                return EAFNOSUPPORT; 
    172177 
    173178        debugf("[%ld] %p->L2capEndpoint::Connect(\"%s\")\n", find_thread(NULL), this, 
     
    233238        debugf("[%ld] %p->L2capEndpoint::Sendable()\n", find_thread(NULL), this); 
    234239 
    235  
    236240        return 0; 
    237241} 
     
    258262 
    259263                endpoint = iterator.Next(); 
    260                 if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm &&  
    261                         endpoint->fState == LISTEN) { 
     264                if (((struct sockaddr_l2cap*)&endpoint->socket->address)->l2cap_psm == psm 
     265                        && endpoint->fState == LISTEN) { 
    262266                        // TODO endpoint ocupied, lock it! define a channel for it 
    263267                        return endpoint; 
  • haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.h

    r28738 r28756  
     1/* 
     2 * Copyright 2008, Haiku, Inc. All Rights Reserved. 
     3 * Distributed under the terms of the MIT License. 
     4 * 
     5 * Authors: 
     6 *              Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com 
     7 */ 
    18#ifndef L2CAP_ENDPOINT_H 
    29#define L2CAP_ENDPOINT_H 
    3  
    410 
    511#include <sys/stat.h> 
     
    1925class L2capEndpoint : public net_protocol,  
    2026                                          public ProtocolSocket, 
    21                       public DoublyLinkedListLinkImpl<L2capEndpoint> 
    22 { 
     27                      public DoublyLinkedListLinkImpl<L2capEndpoint> { 
    2328 
    2429public: 
     
    103108extern DoublyLinkedList<L2capEndpoint> EndpointList; 
    104109 
    105 #endif  // L2cap_ENDPOINT_H 
     110#endif  // L2CAP_ENDPOINT_H 
  • haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp

    r28738 r28756  
    5252 
    5353// module references 
    54 bluetooth_core_data_module_info *btCoreData; 
    55  
    56 net_buffer_module_info *gBufferModule; 
    57 net_stack_module_info *gStackModule; 
    58 net_socket_module_info *gSocketModule; 
    59  
    60 static struct net_domain *sDomain; 
    61  
    62 net_protocol * 
    63 l2cap_init_protocol(net_socket *socket) 
     54bluetooth_core_data_module_info* btCoreData; 
     55 
     56net_buffer_module_info* gBufferModule; 
     57net_stack_module_info* gStackModule; 
     58net_socket_module_info* gSocketModule; 
     59 
     60static struct net_domain* sDomain; 
     61 
     62net_protocol* 
     63l2cap_init_protocol(net_socket* socket) 
    6464{ 
    6565        flowf("\n"); 
     
    7676 
    7777status_t 
    78 l2cap_uninit_protocol(net_protocol *protocol) 
     78l2cap_uninit_protocol(net_protocol* protocol) 
    7979{ 
    8080        flowf("\n"); 
     
    8989 
    9090status_t 
    91 l2cap_open(net_protocol *protocol) 
    92 { 
    93         flowf("\n"); 
    94          
    95         return B_OK; 
    96 } 
    97  
    98  
    99 status_t 
    100 l2cap_close(net_protocol *protocol) 
    101 { 
    102         flowf("\n"); 
    103          
    104         return B_OK; 
    105 } 
    106  
    107  
    108 status_t 
    109 l2cap_free(net_protocol *protocol) 
    110 { 
    111         flowf("\n"); 
    112          
    113         return B_OK; 
    114 } 
    115  
    116  
    117 status_t 
    118 l2cap_connect(net_protocol *protocol, const struct sockaddr *address) 
    119 { 
    120         flowf("\n"); 
    121          
    122         return B_ERROR; 
    123 } 
    124  
    125  
    126 status_t 
    127 l2cap_accept(net_protocol *protocol, struct net_socket **_acceptedSocket) 
     91l2cap_open(net_protocol* protocol) 
     92{ 
     93        flowf("\n"); 
     94         
     95        return B_OK; 
     96} 
     97 
     98 
     99status_t 
     100l2cap_close(net_protocol* protocol) 
     101{ 
     102        flowf("\n"); 
     103         
     104        return B_OK; 
     105} 
     106 
     107 
     108status_t 
     109l2cap_free(net_protocol* protocol) 
     110{ 
     111        flowf("\n"); 
     112         
     113        return B_OK; 
     114} 
     115 
     116 
     117status_t 
     118l2cap_connect(net_protocol* protocol, const struct sockaddr* address) 
     119{ 
     120        flowf("\n"); 
     121         
     122        return B_ERROR; 
     123} 
     124 
     125 
     126status_t 
     127l2cap_accept(net_protocol* protocol, struct net_socket** _acceptedSocket) 
    128128{ 
    129129        flowf("\n"); 
     
    134134 
    135135status_t 
    136 l2cap_control(net_protocol *protocol, int level, int option, void *value, 
    137         size_t *_length) 
     136l2cap_control(net_protocol* protocol, int level, int option, void* value, 
     137        size_t* _length) 
    138138{ 
    139139        flowf("\n"); 
     
    145145 
    146146status_t 
    147 l2cap_getsockopt(net_protocol *protocol, int level, int option, 
    148         void *value, int *length) 
     147l2cap_getsockopt(net_protocol* protocol, int level, int option, 
     148        void* value, int* length) 
    149149{ 
    150150        flowf("\n"); 
     
    156156 
    157157status_t 
    158 l2cap_setsockopt(net_protocol *protocol, int level, int option, 
    159         const void *value, int length) 
     158l2cap_setsockopt(net_protocol* protocol, int level, int option, 
     159        const void* value, int length) 
    160160{ 
    161161        flowf("\n"); 
     
    176176 
    177177status_t 
    178 l2cap_unbind(net_protocol *protocol, struct sockaddr *address) 
    179 { 
    180         flowf("\n"); 
    181          
    182         return B_ERROR; 
    183 } 
    184  
    185  
    186 status_t 
    187 l2cap_listen(net_protocol *protocol, int count) 
     178l2cap_unbind(net_protocol* protocol, struct sockaddr* address) 
     179{ 
     180        flowf("\n"); 
     181         
     182        return B_ERROR; 
     183} 
     184 
     185 
     186status_t 
     187l2cap_listen(net_protocol* protocol, int count) 
    188188{ 
    189189        return ((L2capEndpoint*)protocol)->Listen(count); 
     
    192192 
    193193status_t 
    194 l2cap_shutdown(net_protocol *protocol, int direction) 
     194l2cap_shutdown(net_protocol* protocol, int direction) 
    195195{ 
    196196        flowf("\n"); 
     
    201201 
    202202status_t 
    203 l2cap_send_data(net_protocol *protocol, net_buffer *buffer) 
     203l2cap_send_data(net_protocol* protocol, net_buffer* buffer) 
    204204{ 
    205205        flowf("\n"); 
     
    210210 
    211211status_t 
    212 l2cap_send_routed_data(net_protocol *protocol, struct net_route *route, 
    213         net_buffer *buffer) 
     212l2cap_send_routed_data(net_protocol* protocol, struct net_route* route, 
     213        net_buffer* buffer) 
    214214{ 
    215215        flowf("\n"); 
     
    220220 
    221221ssize_t 
    222 l2cap_send_avail(net_protocol *protocol) 
    223 { 
    224         flowf("\n"); 
    225          
    226         return B_ERROR; 
    227 } 
    228  
    229  
    230 status_t 
    231 l2cap_read_data(net_protocol *protocol, size_t numBytes, uint32 flags, 
    232         net_buffer **_buffer) 
     222l2cap_send_avail(net_protocol* protocol) 
     223{ 
     224        flowf("\n"); 
     225         
     226        return B_ERROR; 
     227} 
     228 
     229 
     230status_t 
     231l2cap_read_data(net_protocol* protocol, size_t numBytes, uint32 flags, 
     232        net_buffer** _buffer) 
    233233{ 
    234234        flowf("\n"); 
     
    239239 
    240240ssize_t 
    241 l2cap_read_avail(net_protocol *protocol) 
    242 { 
    243         flowf("\n"); 
    244          
    245         return B_ERROR; 
    246 } 
    247  
    248  
    249 struct net_domain * 
    250 l2cap_get_domain(net_protocol *protocol) 
     241l2cap_read_avail(net_protocol* protocol) 
     242{ 
     243        flowf("\n"); 
     244         
     245        return B_ERROR; 
     246} 
     247 
     248 
     249struct net_domain* 
     250l2cap_get_domain(net_protocol* protocol) 
    251251{ 
    252252        flowf("\n"); 
     
    257257 
    258258size_t 
    259 l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address) 
     259l2cap_get_mtu(net_protocol* protocol, const struct sockaddr* address) 
    260260{ 
    261261        flowf("\n"); 
     
    266266 
    267267status_t 
    268 l2cap_receive_data(net_buffer *buffer) 
    269 { 
    270         HciConnection* conn = (HciConnection*) buffer; 
     268l2cap_receive_data(net_buffer* buffer) 
     269{ 
     270        HciConnection* conn = (HciConnection*)buffer; 
    271271        debugf("received some data, buffer length %lu\n", conn->currentRxPacket->size); 
    272272         
     
    278278 
    279279status_t 
    280 l2cap_error(uint32 code, net_buffer *data) 
    281 { 
    282         flowf("\n"); 
    283          
    284         return B_ERROR; 
    285 } 
    286  
    287  
    288 status_t 
    289 l2cap_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code, 
    290         void *errorData) 
     280l2cap_error(uint32 code, net_buffer* data) 
     281{ 
     282        flowf("\n"); 
     283         
     284        return B_ERROR; 
     285} 
     286 
     287 
     288status_t 
     289l2cap_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code, 
     290        void* errorData) 
    291291{ 
    292292        flowf("\n"); 
     
    385385 
    386386module_dependency module_dependencies[] = { 
    387         {NET_STACK_MODULE_NAME, (module_info **)&gStackModule}, 
    388         {NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule}, 
    389         {BT_CORE_DATA_MODULE_NAME, (module_info **)&btCoreData}, 
    390         {NET_SOCKET_MODULE_NAME, (module_info **)&gSocketModule}, 
     387        {NET_STACK_MODULE_NAME, (module_info**)&gStackModule}, 
     388        {NET_BUFFER_MODULE_NAME, (module_info**)&gBufferModule}, 
     389        {BT_CORE_DATA_MODULE_NAME, (module_info**)&btCoreData}, 
     390        {NET_SOCKET_MODULE_NAME, (module_info**)&gSocketModule}, 
    391391        {} 
    392392}; 
    393393 
    394 module_info *modules[] = { 
    395         (module_info *)&gL2CAPModule, 
     394module_info* modules[] = { 
     395        (module_info*)&gL2CAPModule, 
    396396        NULL 
    397397}; 
  • haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h

    r25768 r28756  
    11/* 
    2  * Copyright 2006, Haiku, Inc. All Rights Reserved. 
     2 * Copyright 2007, Haiku, Inc. All Rights Reserved. 
    33 * Distributed under the terms of the MIT License. 
    44 * 
     
    66 *              Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com 
    77 */ 
    8  
    9  
    108#ifndef L2CAP_ADDRESS_H 
    119#define L2CAP_ADDRESS_H