OLD | NEW |
| (Empty) |
1 /* Licensed to the Apache Software Foundation (ASF) under one or more | |
2 * contributor license agreements. See the NOTICE file distributed with | |
3 * this work for additional information regarding copyright ownership. | |
4 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
5 * (the "License"); you may not use this file except in compliance with | |
6 * the License. You may obtain a copy of the License at | |
7 * | |
8 * http://www.apache.org/licenses/LICENSE-2.0 | |
9 * | |
10 * Unless required by applicable law or agreed to in writing, software | |
11 * distributed under the License is distributed on an "AS IS" BASIS, | |
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 * See the License for the specific language governing permissions and | |
14 * limitations under the License. | |
15 */ | |
16 | |
17 /* | |
18 * | |
19 * @author Mladen Turk | |
20 * @version $Id: multicast.c 1650120 2015-01-07 17:17:37Z schultz $ | |
21 */ | |
22 | |
23 #include "tcn.h" | |
24 | |
25 TCN_IMPLEMENT_CALL(jint, Multicast, join)(TCN_STDARGS, | |
26 jlong sock, jlong join, | |
27 jlong iface, jlong source) | |
28 { | |
29 tcn_socket_t *s = J2P(sock, tcn_socket_t *); | |
30 apr_sockaddr_t *ja = J2P(join, apr_sockaddr_t *); | |
31 apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *); | |
32 apr_sockaddr_t *sa = J2P(source, apr_sockaddr_t *); | |
33 UNREFERENCED_STDARGS; | |
34 return (jint)apr_mcast_join(s->sock, ja, ia, sa); | |
35 } | |
36 | |
37 TCN_IMPLEMENT_CALL(jint, Multicast, leave)(TCN_STDARGS, | |
38 jlong sock, jlong addr, | |
39 jlong iface, jlong source) | |
40 { | |
41 tcn_socket_t *s = J2P(sock, tcn_socket_t *); | |
42 apr_sockaddr_t *aa = J2P(addr, apr_sockaddr_t *); | |
43 apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *); | |
44 apr_sockaddr_t *sa = J2P(source, apr_sockaddr_t *); | |
45 UNREFERENCED_STDARGS; | |
46 return (jint)apr_mcast_leave(s->sock, aa, ia, sa); | |
47 } | |
48 | |
49 TCN_IMPLEMENT_CALL(jint, Multicast, hops)(TCN_STDARGS, | |
50 jlong sock, jint ttl) | |
51 { | |
52 tcn_socket_t *s = J2P(sock, tcn_socket_t *); | |
53 UNREFERENCED_STDARGS; | |
54 return (jint)apr_mcast_hops(s->sock, (apr_byte_t)ttl); | |
55 } | |
56 | |
57 TCN_IMPLEMENT_CALL(jint, Multicast, loopback)(TCN_STDARGS, | |
58 jlong sock, jboolean opt) | |
59 { | |
60 tcn_socket_t *s = J2P(sock, tcn_socket_t *); | |
61 apr_byte_t on = 0; | |
62 UNREFERENCED_STDARGS; | |
63 if (opt) | |
64 on = 1; | |
65 return (jint)apr_mcast_loopback(s->sock, on); | |
66 } | |
67 | |
68 TCN_IMPLEMENT_CALL(jint, Multicast, ointerface)(TCN_STDARGS, | |
69 jlong sock, jlong iface) | |
70 { | |
71 tcn_socket_t *s = J2P(sock, tcn_socket_t *); | |
72 apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *); | |
73 UNREFERENCED_STDARGS; | |
74 return (jint)apr_mcast_interface(s->sock, ia); | |
75 } | |
OLD | NEW |