* int32_t, uint32_t are now of type "int", and no longer of type "long".

This should help to reduce the number of warnings imported code will throw
  during compilation (helps a lot with tcpdump, for example).
* Since long is 64 bit on 64 bit platforms, we might want to think about doing
  that change for the Haiku types int32 and uint32 as well.
* Fixed several occurences of hidden type problems.
* Fixed build of the stack and TCP under BeOS.
* Fixed incorrect typedef in socket_interface.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-10-21 20:10:43 +00:00
parent 3dfa121266
commit 15ab0bcf01
22 changed files with 169 additions and 117 deletions
+3 -2
View File
@@ -5,20 +5,21 @@
* Authors:
* Hugo Santos, [email protected]
*/
#ifndef PROTOCOL_UTILITIES_H
#define PROTOCOL_UTILITIES_H
#include <lock.h>
#include <Select.h>
#include <util/AutoLock.h>
#include <util/DoublyLinkedList.h>
#include <AddressUtilities.h>
#include <net_buffer.h>
#include <net_protocol.h>
#include <net_socket.h>
#include <net_stack.h>
#include <AddressUtilities.h>
class BenaphoreLocking {
public:
+20 -15
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef NET_SOCKET_H
@@ -9,9 +9,10 @@
#include <net_buffer.h>
#include <sys/socket.h>
#include <Select.h>
#include <lock.h>
struct selectsync;
#define NET_SOCKET_MODULE_NAME "network/stack/socket/v1"
@@ -42,32 +43,36 @@ typedef struct net_socket {
struct net_socket_module_info {
struct module_info info;
status_t (*open_socket)(int family, int type, int protocol, net_socket **_socket);
status_t (*open_socket)(int family, int type, int protocol,
net_socket **_socket);
status_t (*close)(net_socket *socket);
status_t (*free)(net_socket *socket);
status_t (*readv)(net_socket *socket, const iovec *vecs, size_t vecCount,
size_t *_length);
status_t (*writev)(net_socket *socket, const iovec *vecs, size_t vecCount,
size_t *_length);
status_t (*control)(net_socket *socket, int32 op, void *data, size_t length);
status_t (*readv)(net_socket *socket, const iovec *vecs,
size_t vecCount, size_t *_length);
status_t (*writev)(net_socket *socket, const iovec *vecs,
size_t vecCount, size_t *_length);
status_t (*control)(net_socket *socket, int32 op, void *data,
size_t length);
ssize_t (*read_avail)(net_socket *socket);
ssize_t (*send_avail)(net_socket *socket);
status_t (*send_data)(net_socket *socket, net_buffer *buffer);
status_t (*receive_data)(net_socket *socket, size_t length, uint32 flags,
net_buffer **_buffer);
status_t (*receive_data)(net_socket *socket, size_t length,
uint32 flags, net_buffer **_buffer);
status_t (*get_option)(net_socket *socket, int level, int option,
void *value, int *_length);
status_t (*set_option)(net_socket *socket, int level, int option,
const void *value, int length);
status_t (*get_next_stat)(uint32 *cookie, int family, struct net_stat *stat);
status_t (*get_next_stat)(uint32 *cookie, int family,
struct net_stat *stat);
// connections
status_t (*spawn_pending_socket)(net_socket *parent, net_socket **_socket);
status_t (*spawn_pending_socket)(net_socket *parent,
net_socket **_socket);
void (*delete_socket)(net_socket *socket);
status_t (*dequeue_connected)(net_socket *parent, net_socket **_socket);
ssize_t (*count_connected)(net_socket *parent);
@@ -75,10 +80,10 @@ struct net_socket_module_info {
status_t (*set_connected)(net_socket *socket);
// notifications
status_t (*request_notification)(net_socket *socket, uint8 event, uint32 ref,
selectsync *sync);
status_t (*request_notification)(net_socket *socket, uint8 event,
uint32 ref, struct selectsync *sync);
status_t (*cancel_notification)(net_socket *socket, uint8 event,
selectsync *sync);
struct selectsync *sync);
status_t (*notify)(net_socket *socket, uint8 event, int32 value);
// standard socket API
+16 -11
View File
@@ -78,9 +78,10 @@ struct net_stack_module_info {
status_t (*register_domain_receiving_protocol)(int family, int type,
const char *moduleName);
status_t (*get_domain_receiving_protocol)(struct net_domain *domain, uint32 type,
struct net_protocol_module_info **_module);
status_t (*put_domain_receiving_protocol)(struct net_domain *domain, uint32 type);
status_t (*get_domain_receiving_protocol)(struct net_domain *domain,
uint32 type, struct net_protocol_module_info **_module);
status_t (*put_domain_receiving_protocol)(struct net_domain *domain,
uint32 type);
// devices
status_t (*register_device_deframer)(struct net_device *device,
@@ -94,33 +95,37 @@ struct net_stack_module_info {
status_t (*unregister_device_handler)(struct net_device *device, int32 type);
status_t (*register_device_monitor)(struct net_device *device,
struct net_device_monitor *monitor);
struct net_device_monitor *monitor);
status_t (*unregister_device_monitor)(struct net_device *device,
struct net_device_monitor *monitor);
struct net_device_monitor *monitor);
status_t (*device_link_changed)(struct net_device *device);
status_t (*device_removed)(struct net_device *device);
status_t (*device_enqueue_buffer)(struct net_device *device,
struct net_buffer *buffer);
struct net_buffer *buffer);
// Utility Functions
// notification
status_t (*notify_socket)(struct net_socket *socket, uint8 event, int32 value);
status_t (*notify_socket)(struct net_socket *socket, uint8 event,
int32 value);
// checksum
uint16 (*checksum)(uint8 *buffer, size_t length);
// fifo
status_t (*init_fifo)(struct net_fifo *fifo, const char *name, size_t maxBytes);
status_t (*init_fifo)(struct net_fifo *fifo, const char *name,
size_t maxBytes);
void (*uninit_fifo)(struct net_fifo *fifo);
status_t (*fifo_enqueue_buffer)(struct net_fifo *fifo, struct net_buffer *buffer);
status_t (*fifo_enqueue_buffer)(struct net_fifo *fifo,
struct net_buffer *buffer);
ssize_t (*fifo_dequeue_buffer)(struct net_fifo *fifo, uint32 flags,
bigtime_t timeout, struct net_buffer **_buffer);
status_t (*clear_fifo)(struct net_fifo *fifo);
status_t (*fifo_socket_enqueue_buffer)(struct net_fifo *, struct net_socket *,
uint8 event, struct net_buffer *);
status_t (*fifo_socket_enqueue_buffer)(struct net_fifo *fifo,
struct net_socket *socket, uint8 event,
struct net_buffer *buffer);
// timer
void (*init_timer)(struct net_timer *timer, net_timer_func hook, void *data);