adds documentation to the structs

This commit is contained in:
ergz 2023-04-05 01:50:04 -07:00
parent 503317967b
commit ba1d59097c
1 changed files with 15 additions and 2 deletions

17
main.c
View File

@ -38,7 +38,7 @@ typedef struct addrinfo {
Socket address info
- sa_family: AF_XX (e.g AF_INET)
- sa_data: 14 bytes of protocol address
- sa_data: 14 bytes of protocol address, the destination address as well as the port number
*/
typedef struct sockaddr {
unsigned short sa_family;
@ -47,14 +47,27 @@ typedef struct sockaddr {
} sockaddr;
/*
Socket Adress Internet (ipv4)
This struct is used to replace sockaddr in instances where family = AF_INET
- sin_family: AF_INET (ALWAYS)
- sin_port: port
- sin_addr: address struct
- sin_zero: padding to match sockaddr
*/
typedef sockaddr_in {
short int sin_family;
unsigned short int sin_port;
struct in_addr sin_addr;
in_addr sin_addr;
unsigned char sin_zero[8];
} sockaddr_in;
typedef struct in_addr {
uint32_t s_addr;
} in_addr;
int main()
{