/usr/share/gtk-doc/html/gnet/gnet-mcast.html is in libgnet-dev 2.0.8-2.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Mcast</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="libgnet-reference.html" title="GNet Library Reference">
<link rel="prev" href="gnet-udp.html" title="UDP">
<link rel="next" href="gnet-conn-http.html" title="GConnHttp">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnet-udp.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgnet-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-conn-http.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id354324" class="shortcut">Top</a>
 | 
<a href="#id355142" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-mcast"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id354324"></a><span class="refentrytitle">Mcast</span>
</h2>
<p>Mcast — IP Multicast socket</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gnet.h>
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>;
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* <a href="gnet-mcast.html#gnet-mcast-socket-new">gnet_mcast_socket_new</a> (void);
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* <a href="gnet-mcast.html#gnet-mcast-socket-new-with-port">gnet_mcast_socket_new_with_port</a> (gint port);
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* <a href="gnet-mcast.html#gnet-mcast-socket-new-full">gnet_mcast_socket_new_full</a> (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
gint port);
void <a href="gnet-mcast.html#gnet-mcast-socket-delete">gnet_mcast_socket_delete</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
void <a href="gnet-mcast.html#gnet-mcast-socket-ref">gnet_mcast_socket_ref</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
void <a href="gnet-mcast.html#gnet-mcast-socket-unref">gnet_mcast_socket_unref</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
GIOChannel* <a href="gnet-mcast.html#gnet-mcast-socket-get-io-channel">gnet_mcast_socket_get_io_channel</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
<a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a>* <a href="gnet-mcast.html#gnet-mcast-socket-get-local-inetaddr">gnet_mcast_socket_get_local_inetaddr</a>
(const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint <a href="gnet-mcast.html#gnet-mcast-socket-join-group">gnet_mcast_socket_join_group</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);
gint <a href="gnet-mcast.html#gnet-mcast-socket-leave-group">gnet_mcast_socket_leave_group</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);
gint <a href="gnet-mcast.html#gnet-mcast-socket-get-ttl">gnet_mcast_socket_get_ttl</a> (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint <a href="gnet-mcast.html#gnet-mcast-socket-set-ttl">gnet_mcast_socket_set_ttl</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gint ttl);
gint <a href="gnet-mcast.html#gnet-mcast-socket-send">gnet_mcast_socket_send</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const gchar *buffer,
gint length,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *dst);
gint <a href="gnet-mcast.html#gnet-mcast-socket-receive">gnet_mcast_socket_receive</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gchar *buffer,
gint length,
<a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> **src);
gboolean <a href="gnet-mcast.html#gnet-mcast-socket-has-packet">gnet_mcast_socket_has_packet</a> (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint <a href="gnet-mcast.html#gnet-mcast-socket-is-loopback">gnet_mcast_socket_is_loopback</a> (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint <a href="gnet-mcast.html#gnet-mcast-socket-set-loopback">gnet_mcast_socket_set_loopback</a> (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gboolean enable);
#define <a href="gnet-mcast.html#gnet-mcast-socket-to-udp-socket">gnet_mcast_socket_to_udp_socket</a> (MS)
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id355142"></a><h2>Description</h2>
<p>
The Mcast module provides support for IP Multicast sockets. IP
Multicast allows you to send one packet to many receivers at once.
Unfortunately, IP Multicast is not widely available. IP Multicast is
built on UDP.
</p>
<p>
An IP Multicast socket is represented by a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> stucture. To
create a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>, call <a href="gnet-mcast.html#gnet-mcast-socket-new"><code class="function">gnet_mcast_socket_new()</code></a>,
<a href="gnet-mcast.html#gnet-mcast-socket-new-with-port"><code class="function">gnet_mcast_socket_new_with_port()</code></a>, or <a href="gnet-mcast.html#gnet-mcast-socket-new-full"><code class="function">gnet_mcast_socket_new_full()</code></a>.
Then call <a href="gnet-mcast.html#gnet-mcast-socket-join-group"><code class="function">gnet_mcast_socket_join_group()</code></a> to join a multicast group.
To leave the group, call <a href="gnet-mcast.html#gnet-mcast-socket-leave-group"><code class="function">gnet_mcast_socket_leave_group()</code></a>.
</p>
<p>
Use <a href="gnet-mcast.html#gnet-mcast-socket-set-loopback"><code class="function">gnet_mcast_socket_set_loopback()</code></a> to set whether packets sent by
the host will also be received by the host. Applications typically
disable loopback.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id355246"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id355256"></a><h3>
<a name="GMcastSocket"></a>GMcastSocket</h3>
<a class="indexterm" name="id355268"></a><pre class="programlisting">typedef struct _GMcastSocket GMcastSocket;</pre>
<p>
A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> structure represents a IP Multicast socket. The
implementation is hidden. A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is child of
<a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>. Use <a href="gnet-mcast.html#gnet-mcast-socket-to-udp-socket"><code class="function">gnet_mcast_socket_to_udp_socket()</code></a> to safely cast
a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> to a <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355337"></a><h3>
<a name="gnet-mcast-socket-new"></a>gnet_mcast_socket_new ()</h3>
<a class="indexterm" name="id355350"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* gnet_mcast_socket_new (void);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to all interfaces and an arbitrary
port.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355405"></a><h3>
<a name="gnet-mcast-socket-new-with-port"></a>gnet_mcast_socket_new_with_port ()</h3>
<a class="indexterm" name="id355417"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* gnet_mcast_socket_new_with_port (gint port);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to all interfaces and port <em class="parameter"><code>port</code></em>.
If <em class="parameter"><code>port</code></em> is 0, an arbitrary port will be used. Use this
constructor if you know the port of the group you will join. Most
applications will use this constructor.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>port</code></em> :</span></td>
<td> port to bind to
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355506"></a><h3>
<a name="gnet-mcast-socket-new-full"></a>gnet_mcast_socket_new_full ()</h3>
<a class="indexterm" name="id355518"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>* gnet_mcast_socket_new_full (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
gint port);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to interface <em class="parameter"><code>iface</code></em> and port <em class="parameter"><code>port</code></em>.
If <em class="parameter"><code>iface</code></em> is NULL, all interfaces will be used. If <em class="parameter"><code>port</code></em> is 0, an
arbitrary port will be used. To receive packets from this group,
call <a href="gnet-mcast.html#gnet-mcast-socket-join-group"><code class="function">gnet_mcast_socket_join_group()</code></a> next. Loopback is disabled by
default.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>iface</code></em> :</span></td>
<td> interface to bind to (NULL for all interfaces)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>port</code></em> :</span></td>
<td> port to bind to (0 for an arbitrary port)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355651"></a><h3>
<a name="gnet-mcast-socket-delete"></a>gnet_mcast_socket_delete ()</h3>
<a class="indexterm" name="id355664"></a><pre class="programlisting">void gnet_mcast_socket_delete (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Deletes a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. Does nothing if <em class="parameter"><code>socket</code></em> is NULL.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>, or NULL
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355735"></a><h3>
<a name="gnet-mcast-socket-ref"></a>gnet_mcast_socket_ref ()</h3>
<a class="indexterm" name="id355747"></a><pre class="programlisting">void gnet_mcast_socket_ref (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Adds a reference to a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355812"></a><h3>
<a name="gnet-mcast-socket-unref"></a>gnet_mcast_socket_unref ()</h3>
<a class="indexterm" name="id355824"></a><pre class="programlisting">void gnet_mcast_socket_unref (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Removes a reference from a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is
deleted when the reference count reaches 0.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355897"></a><h3>
<a name="gnet-mcast-socket-get-io-channel"></a>gnet_mcast_socket_get_io_channel ()</h3>
<a class="indexterm" name="id355910"></a><pre class="programlisting">GIOChannel* gnet_mcast_socket_get_io_channel (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the <span class="type">GIOChannel</span> of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.
</p>
<p>
Use the channel with <code class="function">g_io_add_watch()</code> to check if the socket is
readable or writable. If the channel is readable, call
<a href="gnet-mcast.html#gnet-mcast-socket-receive"><code class="function">gnet_mcast_socket_receive()</code></a> to receive a packet. If the channel
is writable, call <a href="gnet-mcast.html#gnet-mcast-socket-send"><code class="function">gnet_mcast_socket_send()</code></a> to send a packet. This
is not a normal giochannel - do not read from or write to it.
</p>
<p>
Every <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has one and only one <span class="type">GIOChannel</span>. If you ref
the channel, then you must unref it eventually. Do not close the
channel. The channel is closed by GNet when the socket is
deleted.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a <span class="type">GIOChannel</span>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356057"></a><h3>
<a name="gnet-mcast-socket-get-local-inetaddr"></a>gnet_mcast_socket_get_local_inetaddr ()</h3>
<a class="indexterm" name="id356070"></a><pre class="programlisting"><a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a>* gnet_mcast_socket_get_local_inetaddr
(const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the local host's address from a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a <a href="gnet-inetaddr.html#GInetAddr"><span class="type">GInetAddr</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356153"></a><h3>
<a name="gnet-mcast-socket-join-group"></a>gnet_mcast_socket_join_group ()</h3>
<a class="indexterm" name="id356165"></a><pre class="programlisting">gint gnet_mcast_socket_join_group (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);</pre>
<p>
Joins a multicast group. Join only one group per socket.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>inetaddr</code></em> :</span></td>
<td> address of the group
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 on success.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356254"></a><h3>
<a name="gnet-mcast-socket-leave-group"></a>gnet_mcast_socket_leave_group ()</h3>
<a class="indexterm" name="id356267"></a><pre class="programlisting">gint gnet_mcast_socket_leave_group (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);</pre>
<p>
Leaves a mulitcast group.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>inetaddr</code></em> :</span></td>
<td> address of the group
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 on success.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356355"></a><h3>
<a name="gnet-mcast-socket-get-ttl"></a>gnet_mcast_socket_get_ttl ()</h3>
<a class="indexterm" name="id356368"></a><pre class="programlisting">gint gnet_mcast_socket_get_ttl (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the multicast time-to-live (TTL) of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. All IP
multicast packets have a TTL field. This field is decremented by
a router before it forwards the packet. If the TTL reaches zero,
the packet is discarded. The default value is sufficient for most
applications.
</p>
<p>
The table below shows the scope for a given TTL. The scope is
only an estimate.
</p>
<p>
</p>
<div class="table">
<a name="id356412"></a><p class="title"><b>Table 1. TTL and scope</b></p>
<div class="table-contents"><table summary="TTL and scope" border="1">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th align="left">TTL</th>
<th align="left">Scope</th>
</tr></thead>
<tbody>
<tr>
<td align="left">0</td>
<td align="left">node local</td>
</tr>
<tr>
<td align="left">1</td>
<td align="left">link local</td>
</tr>
<tr>
<td align="left">2-32</td>
<td align="left">site local</td>
</tr>
<tr>
<td align="left">33-64</td>
<td align="left">region local</td>
</tr>
<tr>
<td align="left">65-128</td>
<td align="left">continent local</td>
</tr>
<tr>
<td align="left">129-255</td>
<td align="left">unrestricted (global)</td>
</tr>
</tbody>
</table></div>
</div>
<p><br class="table-break"></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the TTL (an integer between 0 and 255), -1 if the kernel
default is being used, or an integer less than -1 on error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356543"></a><h3>
<a name="gnet-mcast-socket-set-ttl"></a>gnet_mcast_socket_set_ttl ()</h3>
<a class="indexterm" name="id356556"></a><pre class="programlisting">gint gnet_mcast_socket_set_ttl (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gint ttl);</pre>
<p>
Sets the time-to-live (TTL) default of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. Set the TTL
to -1 to use the kernel default. The default value is sufficient
for most applications.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ttl</code></em> :</span></td>
<td> value to set TTL to
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 if successful.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356653"></a><h3>
<a name="gnet-mcast-socket-send"></a>gnet_mcast_socket_send ()</h3>
<a class="indexterm" name="id356665"></a><pre class="programlisting">gint gnet_mcast_socket_send (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
const gchar *buffer,
gint length,
const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *dst);</pre>
<p>
Sends data to a host using a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> buffer to send
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> length of buffer
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>dst</code></em> :</span></td>
<td> destination address
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 if successful.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356803"></a><h3>
<a name="gnet-mcast-socket-receive"></a>gnet_mcast_socket_receive ()</h3>
<a class="indexterm" name="id356815"></a><pre class="programlisting">gint gnet_mcast_socket_receive (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gchar *buffer,
gint length,
<a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> **src);</pre>
<p>
Receives data using a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. If <em class="parameter"><code>src</code></em> is set, the source
address is stored in the location <em class="parameter"><code>src</code></em> points to. The address is
caller owned.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> buffer to write to
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> length of <em class="parameter"><code>buffer</code></em>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>src</code></em> :</span></td>
<td> pointer to source address (optional)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of bytes received, -1 if unsuccessful.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356971"></a><h3>
<a name="gnet-mcast-socket-has-packet"></a>gnet_mcast_socket_has_packet ()</h3>
<a class="indexterm" name="id356984"></a><pre class="programlisting">gboolean gnet_mcast_socket_has_packet (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Tests if a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has a packet waiting to be received.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> TRUE if there is packet waiting, FALSE otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357059"></a><h3>
<a name="gnet-mcast-socket-is-loopback"></a>gnet_mcast_socket_is_loopback ()</h3>
<a class="indexterm" name="id357072"></a><pre class="programlisting">gint gnet_mcast_socket_is_loopback (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Checks if a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has loopback enabled. If loopback is
enabled, all packets sent by the host will also be received by the
host. Loopback is disabled by default.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 if loopback is disabled, 1 if enabled, and -1 on error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357149"></a><h3>
<a name="gnet-mcast-socket-set-loopback"></a>gnet_mcast_socket_set_loopback ()</h3>
<a class="indexterm" name="id357162"></a><pre class="programlisting">gint gnet_mcast_socket_set_loopback (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
gboolean enable);</pre>
<p>
Enables (or disables) loopback on a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. Loopback is
disabled by default.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>enable</code></em> :</span></td>
<td> should loopback be enabled?
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> 0 if successful.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357258"></a><h3>
<a name="gnet-mcast-socket-to-udp-socket"></a>gnet_mcast_socket_to_udp_socket()</h3>
<a class="indexterm" name="id357271"></a><pre class="programlisting">#define gnet_mcast_socket_to_udp_socket(MS) ((GUdpSocket*) (MS))
</pre>
<p>
Converts a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> to a <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>. A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is a
child of <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>MS</code></em> :</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|