Skip to content

Commit

Permalink
Add support for MCAST_JOIN_GROUP & MCAST_LEAVE_GROUP
Browse files Browse the repository at this point in the history
  • Loading branch information
MedourMehdi committed Oct 8, 2024
1 parent 9d78fbc commit 2368f88
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
12 changes: 4 additions & 8 deletions include/bits/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
#define IP_MULTICAST_LOOP 11 /* i_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */

#define MCAST_JOIN_GROUP 19 /* MCAST_JOIN_GROUP is protocol independent */
#define MCAST_LEAVE_GROUP 22

#if 0 /* not yet supported or defined */
#define IP_UNBLOCK_SOURCE 14 /* ip_mreq_source: unblock data from source */
#define IP_BLOCK_SOURCE 15 /* ip_mreq_source: block data from source */
Expand Down Expand Up @@ -124,14 +128,6 @@ struct ip_opts
char ip_opts[40]; /* Actually variable in size. */
};

/* Like `struct ip_mreq' but including interface specification by index. */
struct ip_mreqn
{
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_address; /* local IP address of interface */
int imr_ifindex; /* Interface index */
};

/* Structure used for IP_PKTINFO. */
struct in_pktinfo
{
Expand Down
17 changes: 17 additions & 0 deletions include/bits/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ struct sockaddr
char sa_data[14]; /* Address data. */
};


#if 0
/* Structure large enough to hold any socket address (with the historical
exception of AF_UNIX). We reserve 128 bytes. */
#define __ss_aligntype unsigned long int
Expand All @@ -186,7 +188,22 @@ struct sockaddr_storage
__ss_aligntype __ss_align; /* Force desired alignment. */
char __ss_padding[_SS_PADSIZE];
};
#endif

/*
* Desired design of maximum size and alignment.
*/
#define _SS_MAXSIZE 128
#define _SS_ALIGNSIZE sizeof(unsigned short)

#define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (sa_family_t)) % _SS_ALIGNSIZE)
#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))

struct sockaddr_storage {
sa_family_t ss_family;
char __ss_pad1[_SS_PAD1SIZE];
unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
};

/* Bits in the FLAGS argument to `send', `recv', et al. */
enum
Expand Down
9 changes: 9 additions & 0 deletions include/netinet/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ struct ip_mreq_source
/* IP address of source. */
struct in_addr imr_sourceaddr;
};

/* Like `struct ip_mreq' but including interface specification by index. */
struct ip_mreqn
{
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_address; /* local IP address of interface */
int imr_ifindex; /* Interface index */
};

#endif

#if !__USE_KERNEL_IPV6_DEFS
Expand Down
9 changes: 9 additions & 0 deletions include/sockios.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@
#define SIOCGARP (('S' << 8) | 41) /* get ARP table entry */
#define SIOCSARP (('S' << 8) | 42) /* set ARP table entry */

#ifdef __USE_GNU

#ifdef SIOCGIFNAME
#undef SIOCGIFNAME
#define SIOCGIFNAME SIOCGIFNAME_ETH
#endif

#endif

#endif /* _SOCKIOS_H */

0 comments on commit 2368f88

Please sign in to comment.