aboutsummaryrefslogtreecommitdiff
path: root/net/udpreceive.c
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2010-08-02 21:17:57 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2010-08-02 21:17:57 +0000
commit33e740e227e5cff99a3a45e0e3aab5b0d42ba8b1 (patch)
tree3d3a84f318e69d29333d2f4d8d2c8774b84e465d /net/udpreceive.c
parent33a18c5fd94f8f7d3830e17c22399c643ef98206 (diff)
Methods for multicast ttl and loopback only make sense on udpsend... updated help patches.
svn path=/trunk/externals/mrpeach/; revision=13738
Diffstat (limited to 'net/udpreceive.c')
-rw-r--r--net/udpreceive.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/net/udpreceive.c b/net/udpreceive.c
index 5517001..3a0886a 100644
--- a/net/udpreceive.c
+++ b/net/udpreceive.c
@@ -33,8 +33,6 @@ typedef struct _udpreceive
t_outlet *x_addrout;
int x_connectsocket;
int x_multicast_joined;
- unsigned int x_multicast_loop_state;
- unsigned int x_multicast_ttl;
long x_total_received;
t_atom x_addrbytes[5];
t_atom x_msgoutbuf[MAX_UDP_RECEIVE];
@@ -45,8 +43,6 @@ void udpreceive_setup(void);
static void udpreceive_free(t_udpreceive *x);
static void *udpreceive_new(t_symbol *s, int argc, t_atom *argv);
static void udpreceive_status(t_udpreceive *x);
-static void udpreceive_set_multicast_ttl(t_udpreceive *x, t_floatarg ttl_hops);
-static void udpreceive_set_multicast_loop(t_udpreceive *x, t_floatarg loop_state);
static void udpreceive_read(t_udpreceive *x, int sockfd);
static void udpreceive_read(t_udpreceive *x, int sockfd)
@@ -108,9 +104,6 @@ static void *udpreceive_new(t_symbol *s, int argc, t_atom *argv)
#endif
int sockfd, portno = 0;
int multicast_joined = 0;
- unsigned char multicast_loop_state;
- unsigned char multicast_ttl;
- unsigned int size;
int intarg, i;
char addr[256] = {'\0'};
@@ -185,10 +178,6 @@ static void *udpreceive_new(t_symbol *s, int argc, t_atom *argv)
{
multicast_joined = 1;
post ("udpreceive: added to multicast group");
- multicast_loop_state = 0;
- if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP,
- &multicast_loop_state, sizeof(multicast_loop_state)) < 0)
- error("udpreceive: setsockopt (IP_MULTICAST_LOOP) failed");
}
}
@@ -219,13 +208,7 @@ static void *udpreceive_new(t_symbol *s, int argc, t_atom *argv)
x->x_addrbytes[i].a_type = A_FLOAT;
x->x_addrbytes[i].a_w.w_float = 0;
}
- getsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &multicast_loop_state, &size);
- //post("udpreceive: multicast loop state is %d", multicast_loop_state);
- getsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &multicast_ttl, &size);
- //post("udpreceive: multicast time to live is %d hop%s", multicast_ttl, (multicast_ttl == 1)?"":"s");
x->x_multicast_joined = multicast_joined;
- x->x_multicast_loop_state = multicast_loop_state;
- x->x_multicast_ttl = multicast_ttl;
x->x_total_received = 0L;
sys_addpollfn(x->x_connectsocket, (t_fdpollfn)udpreceive_read, x);
return (x);
@@ -237,41 +220,10 @@ static void udpreceive_status(t_udpreceive *x)
SETFLOAT(&output_atom, x->x_multicast_joined);
outlet_anything( x->x_addrout, gensym("multicast"), 1, &output_atom);
- SETFLOAT(&output_atom, x->x_multicast_loop_state);
- outlet_anything( x->x_addrout, gensym("multicast_loop"), 1, &output_atom);
- SETFLOAT(&output_atom, x->x_multicast_ttl);
- outlet_anything( x->x_addrout, gensym("multicast_ttl"), 1, &output_atom);
SETFLOAT(&output_atom, x->x_total_received);
outlet_anything( x->x_addrout, gensym("total"), 1, &output_atom);
}
-static void udpreceive_set_multicast_ttl(t_udpreceive *x, t_floatarg ttl_hops)
-{
- int sockfd = x->x_connectsocket;
- unsigned char multicast_ttl = ttl_hops;
- unsigned int size;
-
- if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL,
- &multicast_ttl, sizeof(multicast_ttl)) < 0)
- error("udpreceive: setsockopt (IP_MULTICAST_LOOP) failed");
- getsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &multicast_ttl, &size);
- x->x_multicast_ttl = multicast_ttl;
-}
-
-static void udpreceive_set_multicast_loop(t_udpreceive *x, t_floatarg loop_state)
-{
- int sockfd = x->x_connectsocket;
- unsigned char multicast_loop_state = loop_state;
- unsigned int size;
-
-
- if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP,
- &multicast_loop_state, sizeof(multicast_loop_state)) < 0)
- error("udpreceive: setsockopt (IP_MULTICAST_LOOP) failed");
- getsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &multicast_loop_state, &size);
- x->x_multicast_loop_state = multicast_loop_state;
-}
-
static void udpreceive_free(t_udpreceive *x)
{
if (x->x_connectsocket >= 0)
@@ -288,8 +240,6 @@ void udpreceive_setup(void)
sizeof(t_udpreceive), CLASS_DEFAULT, A_GIMME, 0);
class_addmethod(udpreceive_class, (t_method)udpreceive_status,
gensym("status"), 0);
- class_addmethod(udpreceive_class, (t_method)udpreceive_set_multicast_ttl, gensym("ttl"), A_DEFFLOAT, 0);
- class_addmethod(udpreceive_class, (t_method)udpreceive_set_multicast_loop, gensym("loop"), A_DEFFLOAT, 0);
}
/* end udpreceive.c */