1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Author       Karsten Keil <kkeil@novell.com>
5 *
6 * Thanks to    Jan den Ouden
7 *              Fritz Elfert
8 * Copyright 2008  by Karsten Keil <kkeil@novell.com>
9 */
10
11#ifndef _MISDN_FSM_H
12#define _MISDN_FSM_H
13
14#include <linux/timer.h>
15
16/* Statemachine */
17
18struct FsmInst;
19
20typedef void (*FSMFNPTR)(struct FsmInst *, int, void *);
21
22struct Fsm {
23	FSMFNPTR *jumpmatrix;
24	int state_count, event_count;
25	char **strEvent, **strState;
26};
27
28struct FsmInst {
29	struct Fsm *fsm;
30	int state;
31	int debug;
32	void *userdata;
33	int userint;
34	void (*printdebug) (struct FsmInst *, char *, ...);
35};
36
37struct FsmNode {
38	int state, event;
39	void (*routine) (struct FsmInst *, int, void *);
40};
41
42struct FsmTimer {
43	struct FsmInst *fi;
44	struct timer_list tl;
45	int event;
46	void *arg;
47};
48
49extern int mISDN_FsmNew(struct Fsm *, struct FsmNode *, int);
50extern void mISDN_FsmFree(struct Fsm *);
51extern int mISDN_FsmEvent(struct FsmInst *, int , void *);
52extern void mISDN_FsmChangeState(struct FsmInst *, int);
53extern void mISDN_FsmInitTimer(struct FsmInst *, struct FsmTimer *);
54extern int mISDN_FsmAddTimer(struct FsmTimer *, int, int, void *, int);
55extern void mISDN_FsmRestartTimer(struct FsmTimer *, int, int, void *, int);
56extern void mISDN_FsmDelTimer(struct FsmTimer *, int);
57
58#endif
59