2 * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
19 /** \file recv_common.c common functions of para_recv and para_audiod */
26 void (*crypt_function_recv)(unsigned long len, const unsigned char *indata, unsigned char *outdata) = NULL;
27 void (*crypt_function_send)(unsigned long len, const unsigned char *indata, unsigned char *outdata) = NULL;
29 DEFINE_RECEIVER_ARRAY;
30 static void *parse_receiver_args(int receiver_num, char *options)
32 struct receiver *r = &receivers[receiver_num];
38 // PARA_DEBUG_LOG("%s, options: %s\n", r->name,
39 // options? options : "(none)");
41 PARA_DEBUG_LOG("options: %s\n", options);
42 argc = split_args(options, &argv, " \t");
43 for (i = argc - 1; i >= 0; i--)
44 argv[i + 1] = argv[i];
45 argv[0] = para_strdup(r->name);
47 PARA_DEBUG_LOG("argc = %d, argv[0]: %s\n", argc, argv[0]);
50 argv = para_malloc(2 * sizeof(char*));
54 conf = r->parse_config(argc, argv);
56 for (i = 0; i < argc; i++)
64 void *check_receiver_arg(char *ra, int *receiver_num)
68 PARA_DEBUG_LOG("checking %s\n", ra);
69 for (j = 0; receivers[j].name; j++) {
70 const char *name = receivers[j].name;
71 size_t len = strlen(name);
75 if (strncmp(name, ra, len))
80 if (c && !receivers[j].parse_config)
83 return parse_receiver_args(j, c? ra + len + 1: NULL);
85 PARA_ERROR_LOG("%s", "receiver not found\n");