FreeCalypso > hg > themwi-interim
annotate mtctest/disconnect.c @ 6:33d8b3177540
mtctest compiles in the new environment
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 09 Jun 2024 01:55:28 +0000 |
parents | e7b192a5dee5 |
children | a902ccbf6bbc |
rev | line source |
---|---|
5
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we implement the sending of MNCC_DISC_REQ, |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * signaling a caller-requested disconnect aka hang-up. |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * It is the graceful way of signaling disconnect, |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * as opposed to simply killing the test call process with ^C |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * and letting themwi-mncc handle the broken socket. |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 */ |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <sys/types.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <sys/socket.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdio.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdint.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <stdlib.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <string.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <strings.h> |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "../include/mncc.h" |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "../include/gsm48_const.h" |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 int disconnect_mode; |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 send_disconnect_req() |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 { |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 struct gsm_mncc msg; |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 printf("Sending disconnect request\n"); |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 bzero(&msg, sizeof(struct gsm_mncc)); |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 msg.msg_type = MNCC_DISC_REQ; |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 msg.callref = 1; |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 mncc_set_cause(&msg, GSM48_CAUSE_LOC_USER, |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 GSM48_CC_CAUSE_NORM_CALL_CLEAR); |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 disconnect_mode = 1; |
e7b192a5dee5
mtctest: initial import from old ThemWi
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |