#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
+#include <lopsub.h>
+#include "recv_cmd.lsg.h"
#include "para.h"
#include "error.h"
#include "http.h"
#include "list.h"
#include "sched.h"
-#include "ggo.h"
#include "buffer_tree.h"
#include "recv.h"
-#include "http_recv.cmdline.h"
#include "net.h"
#include "string.h"
#include "fd.h"
free(rn->private_data);
}
-static void *http_recv_parse_config(int argc, char **argv)
-{
- struct http_recv_args_info *tmp = para_calloc(sizeof(*tmp));
-
- http_recv_cmdline_parser(argc, argv, tmp);
- return tmp;
-}
-
static int http_recv_open(struct receiver_node *rn)
{
struct private_http_recv_data *phd;
- struct http_recv_args_info *conf = rn->conf;
- int fd, ret = para_connect_simple(IPPROTO_TCP, conf->host_arg,
- conf->port_arg);
+ struct lls_parse_result *lpr = rn->lpr;
+ const char *r_i = RECV_CMD_OPT_STRING_VAL(HTTP, HOST, lpr);
+ uint32_t r_p = RECV_CMD_OPT_UINT32_VAL(HTTP, PORT, lpr);
+ int fd, ret = para_connect_simple(IPPROTO_TCP, r_i, r_p);
if (ret < 0)
return ret;
return 1;
}
-static void http_recv_free_config(void *conf)
-{
- http_recv_cmdline_parser_free(conf);
- free(conf);
-}
-
-/**
- * The init function of the http receiver.
- *
- * \param r Pointer to the receiver struct to initialize.
- *
- * This initializes all function pointers of \a r.
- */
-void http_recv_init(struct receiver *r)
-{
- struct http_recv_args_info dummy;
-
- http_recv_cmdline_parser_init(&dummy);
- r->open = http_recv_open;
- r->close = http_recv_close;
- r->pre_select = http_recv_pre_select;
- r->post_select = http_recv_post_select;
- r->parse_config = http_recv_parse_config;
- r->free_config = http_recv_free_config;
- r->help = (struct ggo_help)DEFINE_GGO_HELP(http_recv);
- http_recv_cmdline_parser_free(&dummy);
-}
+const struct receiver lsg_recv_cmd_com_http_user_data = {
+ .open = http_recv_open,
+ .close = http_recv_close,
+ .pre_select = http_recv_pre_select,
+ .post_select = http_recv_post_select,
+};