SS5: removed star-release-feature
[lcr.git] / ss5.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** LCR                                                                       **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** ss5-port header file                                                      **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #define SS5_ENABLE                      0x00000001
13 #define SS5_FEATURE_CONNECT             0x00000002
14 #define SS5_FEATURE_NODISCONNECT        0x00000004
15 #define SS5_FEATURE_RELEASEGUARDTIMER   0x00000008
16 #define SS5_FEATURE_BELL                0x00000010
17 #define SS5_FEATURE_PULSEDIALING        0x00000020
18 #define SS5_FEATURE_DELAY               0x00000040
19 #define SS5_FEATURE_SUPPRESS            0x00000100
20
21 /* SS5 port classes */
22 class Pss5 : public PmISDN
23 {
24         public:
25         Pss5(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, struct interface *interface, int channel, int exclusive, int mode);
26         ~Pss5();
27         int message_epoint(unsigned int epoint_id, int message, union parameter *param);
28         void set_tone(const char *dir, const char *name);
29
30         int p_m_s_state; /* current signalling state */
31         int p_m_s_signal; /* current state of current signal */
32         char p_m_s_dial[64]; /* current dialing register */
33         int p_m_s_digit_i; /* current digit of register counter */
34         int p_m_s_pulsecount; /* counts pule dialing half cycles */
35         char p_m_s_last_digit; /* stores last digit that was detected, to fill short signal losses */
36         char p_m_s_last_digit_used; /* stores last digit that was used, to ignore short changes of signal due to noise */
37         int p_m_s_signal_loss; /* sample counter for loss of signal check */
38         int p_m_s_decoder_count; /* samples currently decoded */
39         unsigned char p_m_s_decoder_buffer[SS5_DECODER_NPOINTS]; /* buffer for storing one goertzel window */
40         unsigned char p_m_s_delay_digits[3000/SS5_DECODER_NPOINTS]; /* delay buffer for received digits */
41         unsigned char p_m_s_delay_mute[400/SS5_DECODER_NPOINTS]; /* 40 ms delay on mute, so a 'chirp' can be heared */
42         int p_m_s_sample_nr; /* decoder's sample number, counter */
43         int p_m_s_recog; /* sample counter to wait for signal recognition time */
44         struct lcr_work p_m_s_queue;
45         int p_m_s_answer; /* queued signal */
46         int p_m_s_busy_flash; /* queued signal */
47         int p_m_s_clear_back; /* queued signal */
48
49         void _new_ss5_state(int state, const char *func, int line);
50         void _new_ss5_signal(int signal, const char *func, int line);
51         void inband_receive(unsigned char *buffer, int len);
52         int inband_send(unsigned char *buffer, int len);
53         int inband_dial_mf(unsigned char *buffer, int len, int count);
54         int inband_dial_pulse(unsigned char *buffer, int len, int count);
55         void start_signal(int);
56         void start_outgoing(void);
57         void do_release(int cause, int location);
58         void do_setup(char *digit, int complete);
59
60         void seizing_ind(void);
61         void digit_ind(char digit);
62         void pulse_ind(int on);
63         void proceed_to_send_ind(void);
64         void busy_flash_ind(void);
65         void answer_ind(void);
66         void forward_ind(void);
67         void clear_back_ind(void);
68         void clear_forward_ind(void);
69         void release_guard_ind(void);
70         void double_seizure_ind(void);
71         void forward_transfer_ind(void);
72         void message_setup(unsigned int epoint_id, int message_id, union parameter *param);
73         void message_connect(unsigned int epoint_id, int message_id, union parameter *param);
74         void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
75         void message_release(unsigned int epoint_id, int message_id, union parameter *param);
76
77         void register_timeout(void);
78
79 };
80
81 #define new_ss5_state(a) _new_ss5_state(a, __FUNCTION__, __LINE__)
82 #define new_ss5_signal(a) _new_ss5_signal(a, __FUNCTION__, __LINE__)
83
84 void ss5_create_channel(struct mISDNport *mISDNport, int i);
85 class Pss5 *ss5_hunt_line(struct mISDNport *mISDNport);
86