open-close.c 1.38 KB
Newer Older
1
/*
2
 * Aurelio Colosimo for CERN, 2011 -- GNU LGPL v2.1 or later
3
 */
4

5
#include <pptp/pptp.h>
6 7 8 9 10 11 12 13 14 15

/*
 * This file deals with opening and closing an instance. The channel
 * must already have been created. In practices, this initializes the
 * state machine to the first state.
 *
 * A protocol extension can override none or both of these functions.
 */

struct pp_runtime_opts default_rt_opts = {
16 17 18 19 20 21 22 23 24 25 26 27 28
	.no_adjust = TRUE,
	.no_rst_clk = PP_DEFAULT_NO_RESET_CLOCK,
	.ap = PP_DEFAULT_AP,
	.ai = PP_DEFAULT_AI,
	.s = PP_DEFAULT_DELAY_S,
	.max_foreign_records = PP_DEFAULT_MAX_FOREIGN_RECORDS,
	.cur_utc_ofst = PP_DEFAULT_UTC_OFFSET,
	.announce_intvl = PP_DEFAULT_ANNOUNCE_INTERVAL,
	.sync_intvl = PP_DEFAULT_SYNC_INTERVAL,
	.prio1 = PP_DEFAULT_PRIORITY1,
	.prio2 = PP_DEFAULT_PRIORITY2,
	.domain_number = PP_DEFAULT_DOMAIN_NUMBER,
	.ttl = 1,
29 30 31 32 33 34 35 36 37 38 39 40 41
};

int pp_parse_cmdline(struct pp_instance *ppi, int argc, char **argv)
{
	/* TODO: Check how to parse cmdline. We can not rely on getopt()
	 * function. Which are the really useful parameters?
	 * Every parameter should be contained in ppi->rt_opts and set here
	 */
	return 0;
}

int pp_open_instance(struct pp_instance *ppi, struct pp_runtime_opts *rt_opts)
{
42
	if (rt_opts)
43
		ppi->rt_opts = rt_opts;
44
	else
45
		ppi->rt_opts = &default_rt_opts;
46

47 48 49 50 51 52 53 54 55 56
	ppi->state = PPS_INITIALIZING;

	return 0;
}

int pp_close_instance(struct pp_instance *ppi)
{
	/* Nothing to do by now */
	return 0;
}