adds documentation to the structs
This commit is contained in:
parent
503317967b
commit
ba1d59097c
17
main.c
17
main.c
|
@ -38,7 +38,7 @@ typedef struct addrinfo {
|
||||||
Socket address info
|
Socket address info
|
||||||
|
|
||||||
- sa_family: AF_XX (e.g AF_INET)
|
- 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 {
|
typedef struct sockaddr {
|
||||||
unsigned short sa_family;
|
unsigned short sa_family;
|
||||||
|
@ -47,14 +47,27 @@ typedef struct sockaddr {
|
||||||
} 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 {
|
typedef sockaddr_in {
|
||||||
short int sin_family;
|
short int sin_family;
|
||||||
unsigned short int sin_port;
|
unsigned short int sin_port;
|
||||||
struct in_addr sin_addr;
|
in_addr sin_addr;
|
||||||
unsigned char sin_zero[8];
|
unsigned char sin_zero[8];
|
||||||
} sockaddr_in;
|
} sockaddr_in;
|
||||||
|
|
||||||
|
typedef struct in_addr {
|
||||||
|
uint32_t s_addr;
|
||||||
|
} in_addr;
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue