1 /*
2 * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
3 * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation version 2.1 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18 *
19 */
20
21 #include <libdvbv5/desc_network_name.h>
22 #include <libdvbv5/dvb-fe.h>
23 #include <parse_string.h>
24
25 #if __GNUC__ >= 9
26 #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
27 #endif
28
dvb_desc_network_name_init(struct dvb_v5_fe_parms * parms,const uint8_t * buf,struct dvb_desc * desc)29 int dvb_desc_network_name_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc)
30 {
31 struct dvb_desc_network_name *net = (struct dvb_desc_network_name *) desc;
32 uint8_t len; /* the length of the string in the input data */
33 uint8_t len1; /* the lenght of the output strings */
34
35 len = desc->length;
36 len1 = len;
37 net->network_name = NULL;
38 net->network_name_emph = NULL;
39 dvb_parse_string(parms, &net->network_name, &net->network_name_emph, buf, len1);
40 buf += len;
41 return 0;
42 }
43
dvb_desc_network_name_print(struct dvb_v5_fe_parms * parms,const struct dvb_desc * desc)44 void dvb_desc_network_name_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
45 {
46 const struct dvb_desc_network_name *net = (const struct dvb_desc_network_name *) desc;
47
48 dvb_loginfo("| network name: '%s'", net->network_name);
49 }
50
dvb_desc_network_name_free(struct dvb_desc * desc)51 void dvb_desc_network_name_free(struct dvb_desc *desc)
52 {
53 const struct dvb_desc_network_name *net = (const struct dvb_desc_network_name *) desc;
54
55 free(net->network_name);
56 free(net->network_name_emph);
57 }
58