ArvernOS
Loading...
Searching...
No Matches
descriptor.h File Reference
#include <fs/vfs.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
Include dependency graph for descriptor.h:

Data Structures

struct  descriptor_t
 

Functions

int create_file_descriptor (inode_t inode, uint32_t flags)
 
int create_socket_descriptor (inode_t inode, uint32_t domain, uint32_t type, uint32_t protocol)
 
descriptor_tget_descriptor (int id)
 
void delete_descriptor (int id)
 
int descriptor_udp_lookup (uint16_t port)
 
bool is_protocol_supported (uint32_t type, uint32_t protocol)
 

Function Documentation

◆ create_file_descriptor()

int create_file_descriptor ( inode_t inode,
uint32_t flags )

Creates a file descriptor.

Parameters
inodethe inode for the file descriptor to create
flagssome descriptor flags
Returns
a descriptor ID or -1 in case of an error

◆ create_socket_descriptor()

int create_socket_descriptor ( inode_t inode,
uint32_t domain,
uint32_t type,
uint32_t protocol )

Creates a socket descriptor.

Parameters
inodethe inode for the socket descriptor to create
domainthe domain of the socket
typethe type of the socket
protocolthe protocol of the socket
Returns
a descriptor ID or -1 in case of an error

◆ delete_descriptor()

void delete_descriptor ( int id)

Deletes a descriptor.

Parameters
idthe descriptor ID

◆ descriptor_udp_lookup()

int descriptor_udp_lookup ( uint16_t port)

Returns a socket descriptor for UDP.

Parameters
portthe port bound to the socket to return
Returns
the socket descriptor or -1 when not found

◆ get_descriptor()

descriptor_t * get_descriptor ( int id)

Returns a descriptor.

Parameters
idthe descriptor ID
Returns
a descriptor or NULL

◆ is_protocol_supported()

bool is_protocol_supported ( uint32_t type,
uint32_t protocol )

Returns whether a socket protocol is supported.

TODO: move this function somewhere else.

Parameters
typesocket type
protocolsocket protocol
Returns
true when the protocol is supported, false otherwise