FreeCalypso > hg > themwi-rtp-mgr
annotate librtpalloc/simple_client.c @ 10:9499d41fc393 default tip
daemon: change config file name to themwi-rtp-mgr.cfg
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 27 May 2024 22:47:19 +0000 |
parents | 191d58f5c24f |
children |
rev | line source |
---|---|
6
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * The library function implemented in this C module provides a |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * simple interface for obtaining a single RTP endpoint from |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * themwi-rtp-mgr. This "simple client" option is suitable only |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * for command line utilities, not for daemon processes! |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <sys/types.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <sys/socket.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <sys/un.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdio.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdint.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <stdlib.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <string.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <strings.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include <themwi/rtp/rtp_alloc_if.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include <themwi/rtp/rtp_alloc_resp.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include <themwi/rtp/rtp_alloc_simple.h> |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 static const char ctrl_socket_pathname[] = "/var/gsm/rtp_alloc_socket"; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 static void |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 fill_sockaddr_un(pathname, sunp, lenp) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 char *pathname; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 struct sockaddr_un *sunp; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 unsigned *lenp; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 /* local socket binding voodoo copied from osmocon */ |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 sunp->sun_family = AF_UNIX; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 strncpy(sunp->sun_path, pathname, sizeof(sunp->sun_path)); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 sunp->sun_path[sizeof(sunp->sun_path) - 1] = '\0'; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 /* we use the same magic that X11 uses in Xtranssock.c for |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 * calculating the proper length of the sockaddr */ |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #if defined(BSD44SOCKETS) || defined(__UNIXWARE__) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 sunp->sun_len = strlen(sunp->sun_path); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #endif |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #if defined(BSD44SOCKETS) || defined(SUN_LEN) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 *lenp = SUN_LEN(sunp); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #else |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 *lenp = strlen(sunp->sun_path) + |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 offsetof(struct sockaddr_un, sun_path) + 1; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #endif |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 static void |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 close_fds(resp) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 struct rtp_alloc_resp_wrap *resp; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 unsigned n; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 for (n = 0; n < resp->num_fd; n++) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 close(resp->fd_buf[n]); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 int rtp_alloc_simple(int ep_type, struct rtp_alloc_simple *out) |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 struct sockaddr_un sa; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 unsigned sa_len; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 int ctrl_fd, rc; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 struct rtp_alloc_req req; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 struct rtp_alloc_resp_wrap resp; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 unsigned expect_num_fd; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 switch (ep_type) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 case RTP_ALLOC_TYPE_GSM: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 case RTP_ALLOC_TYPE_PSTN: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 expect_num_fd = 2; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 break; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 case RTP_ALLOC_TYPE_GSM2PSTN: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 case RTP_ALLOC_TYPE_GSM2GSM: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 expect_num_fd = 4; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 break; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 default: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 fprintf(stderr, |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 "rtp_alloc_simple() error: unknown EP type %d\n", |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 ep_type); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 ctrl_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 if (ctrl_fd < 0) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 perror("socket(AF_UNIX, SOCK_SEQPACKET, 0)"); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 fill_sockaddr_un(ctrl_socket_pathname, &sa, &sa_len); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 rc = connect(ctrl_fd, (struct sockaddr *) &sa, sa_len); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 if (rc < 0) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 perror(ctrl_socket_pathname); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 close(ctrl_fd); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 bzero(&req, sizeof req); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 req.ep_type = ep_type; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 rc = send(ctrl_fd, &req, sizeof req, 0); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 if (rc < 0) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 perror("send to RTP allocator socket"); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 close(ctrl_fd); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 rc = collect_rtpmgr_resp(ctrl_fd, 0, &resp); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 if (rc < 0) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 perror("recvmsg from RTP allocator socket"); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 close(ctrl_fd); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 close(ctrl_fd); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 if (resp.resp_len != sizeof(struct rtp_alloc_resp)) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 fprintf(stderr, |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 "error: response packet from themwi-rtp-mgr has wrong length (%u bytes)\n", |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 resp.resp_len); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 close_fds(&resp); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 if (resp.resp.res != RTP_ALLOC_OK) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 fprintf(stderr, "themwi-rtp-mgr returned error %u\n", |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 resp.resp.res); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 close_fds(&resp); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 if (resp.num_fd != expect_num_fd) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 fprintf(stderr, |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 "error: themwi-rtp-mgr returned %u descriptors instead of expected %u\n", |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 resp.num_fd, expect_num_fd); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 close_fds(&resp); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 return(-1); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 switch (ep_type) { |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 case RTP_ALLOC_TYPE_GSM: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 out->gsm_rtp_fd = resp.fd_buf[0]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 out->gsm_rtcp_fd = resp.fd_buf[1]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 break; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 case RTP_ALLOC_TYPE_PSTN: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 out->pstn_rtp_fd = resp.fd_buf[0]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 out->pstn_rtcp_fd = resp.fd_buf[1]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 break; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 case RTP_ALLOC_TYPE_GSM2PSTN: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 case RTP_ALLOC_TYPE_GSM2GSM: |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 out->gsm_rtp_fd = resp.fd_buf[0]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 out->gsm_rtcp_fd = resp.fd_buf[1]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 out->pstn_rtp_fd = resp.fd_buf[2]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 out->pstn_rtcp_fd = resp.fd_buf[3]; |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 } |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 bcopy(&resp.resp.gsm_addr, &out->gsm_addr, |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 sizeof(struct sockaddr_storage)); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 bcopy(&resp.resp.pstn_addr, &out->pstn_addr, |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 sizeof(struct sockaddr_storage)); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 return(0); |
191d58f5c24f
librtpalloc: port the simple client
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |