open-close.c 1.37 KB
Newer Older
1 2 3
/*
 * Alessandro Rubini for CERN, 2011 -- public domain
 */
4
#include <pptp/pptp.h>
5 6 7 8 9 10 11 12 13 14

/*
 * 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 = {
15 16 17 18 19 20 21 22 23 24 25 26 27
	.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,
28 29 30 31 32 33 34 35 36 37 38 39 40
};

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)
{
41
	if (rt_opts)
42
		ppi->rt_opts = rt_opts;
43
	else
44
		ppi->rt_opts = &default_rt_opts;
45

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

	return 0;
}

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