state-uncalibrated.c 723 Bytes
Newer Older
1 2 3
/*
 * FIXME: header
 */
4
#include <pptp/pptp.h>
5
#include "common-fun.h"
6 7 8

int pp_uncalibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
9
	int e = 0;
10
	TimeInternal time; /* TODO: handle it, see handle(...) in protocol.c */
11 12 13 14

	switch (ppi->msg_tmp_header.messageType) {

	case PPM_ANNOUNCE:
15
		e = st_com_slave_handle_announce(ppi, pkt, plen);
16 17 18
		break;

	case PPM_SYNC:
19
		e = st_com_slave_handle_sync(ppi, pkt, plen, &time);
20 21 22
		break;

	case PPM_FOLLOW_UP:
23
		e = st_com_slave_handle_followup(ppi, pkt, plen);
24 25 26 27 28 29 30 31 32 33 34 35 36 37
		break;

	default:
		/* disreguard, nothing to do */
		break;
	}

	if (e == 0)
		st_com_execute_slave(ppi);
	else
		ppi->next_state = PPS_FAULTY;

	ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;

38 39
	return 0;
}