blob: a9f610a8ce2c6c8be1cf7a630b7c90cb968dc929 [file] [log] [blame]
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +02001/* (C) 2009,2010 by Holger Hans Peter Freyther <zecke@selfish.org>
2 * (C) 2009,2010 by On-Waves
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
Sylvain Munaut12ba7782014-06-16 10:13:40 +020020#pragma once
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020021
22#include "tlv.h"
Philipp Maierfa896ab2017-03-27 16:55:32 +020023#include <osmocom/gsm/protocol/gsm_08_08.h>
24#include <sys/socket.h>
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020025
26struct msgb;
27
Philipp Maierfa896ab2017-03-27 16:55:32 +020028struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
29 uint16_t cc, int lac, uint16_t _ci);
30struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc,
31 uint16_t cc, int lac, uint16_t _ci,
32 const struct gsm0808_speech_codec_list
33 *scl);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020034struct msgb *gsm0808_create_reset(void);
Harald Weltea62fe312013-06-19 15:14:37 +020035struct msgb *gsm0808_create_reset_ack(void);
Holger Hans Peter Freythera3f05d82010-10-27 11:49:24 +020036struct msgb *gsm0808_create_clear_command(uint8_t reason);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020037struct msgb *gsm0808_create_clear_complete(void);
Philipp Maierb478dd32017-03-29 15:50:05 +020038struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
39 const uint8_t *cipher_response_mode);
Holger Hans Peter Freyther81716d52010-04-17 06:16:35 +020040struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020041struct msgb *gsm0808_create_cipher_reject(uint8_t cause);
Harald Welte07b625d2012-01-23 10:02:58 +010042struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len,
43 const uint8_t *cm3, uint8_t cm3_len);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020044struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
Philipp Maierc6144a22017-03-29 17:53:43 +020045struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
46 const uint16_t *cic,
47 const struct sockaddr_storage *ss,
48 const struct gsm0808_speech_codec_list *scl,
49 const uint32_t *ci);
Philipp Maierfa896ab2017-03-27 16:55:32 +020050struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
51 uint8_t encr_alg_id, uint8_t speech_mode,
52 const struct sockaddr_storage *ss,
53 const struct gsm0808_speech_codec *sc,
54 const struct gsm0808_speech_codec_list
55 *scl);
Holger Hans Peter Freytherb60a4b32010-07-23 18:35:59 +080056struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
Philipp Maierfa896ab2017-03-27 16:55:32 +020057 uint8_t chosen_channel,
58 uint8_t encr_alg_id,
Holger Hans Peter Freytherba6172a2010-04-17 06:21:49 +020059 uint8_t speech_mode);
Philipp Maierfa896ab2017-03-27 16:55:32 +020060struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause,
61 const struct gsm0808_speech_codec_list
62 *scl);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020063struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause);
Holger Hans Peter Freytheraf270a42010-11-04 12:42:50 +010064struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
Philipp Maier3d48ec02017-03-29 17:37:55 +020065struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
66 const struct gsm0808_cell_id_list *cil,
67 const uint8_t *chan_needed);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020068
Holger Hans Peter Freytherc25c6682010-11-04 12:26:06 +010069struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
Holger Hans Peter Freyther9a3dec02010-05-16 08:15:40 +080070void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);
71
Harald Weltef4d45ab2011-07-16 12:13:00 +020072const struct tlv_definition *gsm0808_att_tlvdef(void);
Holger Hans Peter Freyther280cd512010-04-15 10:10:39 +020073
Harald Welte9b837e62011-07-11 17:43:19 +020074const char *gsm0808_bssmap_name(uint8_t msg_type);
75const char *gsm0808_bssap_name(uint8_t msg_type);