Changeset 28756
- Timestamp:
- 12/01/08 18:09:11 (5 weeks ago)
- Location:
- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap
- Files:
-
- 4 modified
-
L2capEndpoint.cpp (modified) (11 diffs)
-
L2capEndpoint.h (modified) (3 diffs)
-
l2cap.cpp (modified) (16 diffs)
-
l2cap_address.h (modified) (2 diffs)
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 */ 1 8 #include "L2capEndpoint.h" 9 #include "l2cap_address.h" 2 10 3 11 #include <stdio.h> 12 #include <string.h> 4 13 #include <sys/stat.h> 5 #include <string.h> 6 7 #include "l2cap_address.h" 14 8 15 9 16 #include <bluetooth/L2CAP/btL2CAP.h> 10 17 #define BT_DEBUG_THIS_MODULE 11 18 #include <btDebug.h> 19 12 20 13 21 static inline bigtime_t … … 59 67 debugf("[%ld] %p->L2capEndpoint::Init()\n", find_thread(NULL), this); 60 68 61 return (B_OK);69 return B_OK; 62 70 } 63 71 … … 68 76 debugf("[%ld] %p->L2capEndpoint::Uninit()\n", find_thread(NULL), this); 69 77 70 71 78 } 72 79 … … 77 84 debugf("[%ld] %p->L2capEndpoint::Open()\n", find_thread(NULL), this); 78 85 79 status_t error = ProtocolSocket::Open();86 status_t error = ProtocolSocket::Open(); 80 87 if (error != B_OK) 81 return(error); 82 83 84 85 return(B_OK); 88 return error; 89 90 return B_OK; 86 91 } 87 92 … … 92 97 debugf("[%ld] %p->L2capEndpoint::Close()\n", find_thread(NULL), this); 93 98 94 return (B_OK);99 return B_OK; 95 100 } 96 101 … … 101 106 debugf("[%ld] %p->L2capEndpoint::Free()\n", find_thread(NULL), this); 102 107 103 return (B_OK);108 return B_OK; 104 109 } 105 110 … … 112 117 113 118 if (_address->sa_family != AF_BLUETOOTH ) 114 return (EAFNOSUPPORT);119 return EAFNOSUPPORT; 115 120 116 121 // TODO: Check socladdr_l2cap size … … 145 150 debugf("[%ld] %p->L2capEndpoint::Unbind()\n", find_thread(NULL), this); 146 151 147 return (B_OK);152 return B_OK; 148 153 } 149 154 … … 169 174 { 170 175 if (_address->sa_family != AF_BLUETOOTH) 171 return (EAFNOSUPPORT);176 return EAFNOSUPPORT; 172 177 173 178 debugf("[%ld] %p->L2capEndpoint::Connect(\"%s\")\n", find_thread(NULL), this, … … 233 238 debugf("[%ld] %p->L2capEndpoint::Sendable()\n", find_thread(NULL), this); 234 239 235 236 240 return 0; 237 241 } … … 258 262 259 263 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) { 262 266 // TODO endpoint ocupied, lock it! define a channel for it 263 267 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 */ 1 8 #ifndef L2CAP_ENDPOINT_H 2 9 #define L2CAP_ENDPOINT_H 3 4 10 5 11 #include <sys/stat.h> … … 19 25 class L2capEndpoint : public net_protocol, 20 26 public ProtocolSocket, 21 public DoublyLinkedListLinkImpl<L2capEndpoint> 22 { 27 public DoublyLinkedListLinkImpl<L2capEndpoint> { 23 28 24 29 public: … … 103 108 extern DoublyLinkedList<L2capEndpoint> EndpointList; 104 109 105 #endif // L2 cap_ENDPOINT_H110 #endif // L2CAP_ENDPOINT_H -
haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap.cpp
r28738 r28756 52 52 53 53 // 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)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) 64 64 { 65 65 flowf("\n"); … … 76 76 77 77 status_t 78 l2cap_uninit_protocol(net_protocol *protocol)78 l2cap_uninit_protocol(net_protocol* protocol) 79 79 { 80 80 flowf("\n"); … … 89 89 90 90 status_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)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) 128 128 { 129 129 flowf("\n"); … … 134 134 135 135 status_t 136 l2cap_control(net_protocol *protocol, int level, int option, void *value,137 size_t *_length)136 l2cap_control(net_protocol* protocol, int level, int option, void* value, 137 size_t* _length) 138 138 { 139 139 flowf("\n"); … … 145 145 146 146 status_t 147 l2cap_getsockopt(net_protocol *protocol, int level, int option,148 void *value, int *length)147 l2cap_getsockopt(net_protocol* protocol, int level, int option, 148 void* value, int* length) 149 149 { 150 150 flowf("\n"); … … 156 156 157 157 status_t 158 l2cap_setsockopt(net_protocol *protocol, int level, int option,159 const void *value, int length)158 l2cap_setsockopt(net_protocol* protocol, int level, int option, 159 const void* value, int length) 160 160 { 161 161 flowf("\n"); … … 176 176 177 177 status_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)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) 188 188 { 189 189 return ((L2capEndpoint*)protocol)->Listen(count); … … 192 192 193 193 status_t 194 l2cap_shutdown(net_protocol *protocol, int direction)194 l2cap_shutdown(net_protocol* protocol, int direction) 195 195 { 196 196 flowf("\n"); … … 201 201 202 202 status_t 203 l2cap_send_data(net_protocol *protocol, net_buffer *buffer)203 l2cap_send_data(net_protocol* protocol, net_buffer* buffer) 204 204 { 205 205 flowf("\n"); … … 210 210 211 211 status_t 212 l2cap_send_routed_data(net_protocol *protocol, struct net_route *route,213 net_buffer *buffer)212 l2cap_send_routed_data(net_protocol* protocol, struct net_route* route, 213 net_buffer* buffer) 214 214 { 215 215 flowf("\n"); … … 220 220 221 221 ssize_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)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) 233 233 { 234 234 flowf("\n"); … … 239 239 240 240 ssize_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)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) 251 251 { 252 252 flowf("\n"); … … 257 257 258 258 size_t 259 l2cap_get_mtu(net_protocol *protocol, const struct sockaddr *address)259 l2cap_get_mtu(net_protocol* protocol, const struct sockaddr* address) 260 260 { 261 261 flowf("\n"); … … 266 266 267 267 status_t 268 l2cap_receive_data(net_buffer *buffer)269 { 270 HciConnection* conn = (HciConnection*) buffer;268 l2cap_receive_data(net_buffer* buffer) 269 { 270 HciConnection* conn = (HciConnection*)buffer; 271 271 debugf("received some data, buffer length %lu\n", conn->currentRxPacket->size); 272 272 … … 278 278 279 279 status_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)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) 291 291 { 292 292 flowf("\n"); … … 385 385 386 386 module_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}, 391 391 {} 392 392 }; 393 393 394 module_info *modules[] = {395 (module_info *)&gL2CAPModule,394 module_info* modules[] = { 395 (module_info*)&gL2CAPModule, 396 396 NULL 397 397 }; -
haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.h
r25768 r28756 1 1 /* 2 * Copyright 200 6, Haiku, Inc. All Rights Reserved.2 * Copyright 2007, Haiku, Inc. All Rights Reserved. 3 3 * Distributed under the terms of the MIT License. 4 4 * … … 6 6 * Oliver Ruiz Dorantes, oliver-ruiz.dorantes_at_gmail.com 7 7 */ 8 9 10 8 #ifndef L2CAP_ADDRESS_H 11 9 #define L2CAP_ADDRESS_H
