sock: pass protocol to sockets

This commit is contained in:
Matheus
2026-09-10 16:41:21 -03:00
parent 894d9bdaf9
commit 79752fb5e0
9 changed files with 36 additions and 26 deletions
+10 -2
View File
@@ -1,7 +1,15 @@
#ifndef _RAW_H
#define _RAW_H
void raw_process(netdev_t *netdev, void *buffer, uint32_t peer);
socket_t *raw_create_socket(void);
typedef struct socket socket_t;
typedef struct {
uint16_t netdev; // 1-based index that gets transformed into a minor number
uint16_t proto;
uint8_t mac[6];
} raw_addr_t;
void raw_process(netdev_t *netdev, void *buffer, mac_t *sender, uint16_t proto, size_t size);
socket_t *raw_create_socket(int protocol);
#endif
+8 -7
View File
@@ -28,6 +28,7 @@ typedef struct {
netdev_t *netdev;
pollheader_t pollheader;
int type;
int protocol;
int shutdown;
int error;
bool nonblocking;
@@ -363,13 +364,13 @@ static inline size_t sock_countctrl(sockctrl_t *ctrl, size_t len) {
}
void localsock_leavebinding(vnode_t *vnode);
int localsock_pair(socket_t **ret1, socket_t **ret2);
int localsock_pair_seqpacket(socket_t **ret1, socket_t **ret2);
socket_t *localsock_createsocket(void);
socket_t *localsock_create_seqpacket_socket(void);
socket_t *udp_createsocket();
socket_t *tcp_createsocket();
socket_t *socket_create(int type);
int localsock_pair(socket_t **ret1, socket_t **ret2, int protocol);
int localsock_pair_seqpacket(socket_t **ret1, socket_t **ret2, int protocol);
socket_t *localsock_createsocket(int protocol);
socket_t *localsock_create_seqpacket_socket(int protocol);
socket_t *udp_createsocket(int protocol);
socket_t *tcp_createsocket(int protocol);
socket_t *socket_create(int type, int protocol);
int sockfs_newsocket(vnode_t **vnodep, socket_t *socket);
void sockfs_init();