Skip to content

Commit

Permalink
Merge pull request #205 from fjtrujy/addSocketStorage
Browse files Browse the repository at this point in the history
Add sockaddr_storage
  • Loading branch information
sharkwouter authored May 26, 2024
2 parents 9a1a84e + b07d7a1 commit 7ef25e6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/libcglue/sys/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ struct sockaddr {
char sa_data[14]; /* actually longer; address value */
};

/*
* RFC 2553: protocol-independent placeholder for socket addresses
*/
#define _SS_MAXSIZE 128
#define _SS_ALIGNSIZE (sizeof(int64_t))
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - 2)
#define _SS_PAD2SIZE (_SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE)

struct sockaddr_storage {
uint8_t ss_len; /* address length */
sa_family_t ss_family; /* address family */
char __ss_pad1[_SS_PAD1SIZE];
int64_t __ss_align;/* force desired structure storage alignment */
char __ss_pad2[_SS_PAD2SIZE];
};

/*
* Protocol families, same as address families for now.
*/
Expand Down

0 comments on commit 7ef25e6

Please sign in to comment.