/usr/include/gnokii/rlp-common.h is in libgnokii-dev 0.6.31+dfsg-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /*
$Id$
G N O K I I
A Linux/Unix toolset and driver for the mobile phones.
This file is part of gnokii.
Gnokii is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Gnokii is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with gnokii; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 1999-2000 Hugh Blemings & Pavel JanÃk ml.
Copyright (C) 2001 Chris Kemp, Pavel Machek
Copyright (C) 2003 Pawel Kot
The development of RLP protocol was sponsored by SuSE CR, s.r.o. (Pavel use
the SIM card from SuSE for testing purposes).
Header file for RLP protocol.
*/
#ifndef _gnokii_rlp_common_h
#define _gnokii_rlp_common_h
/* Typedef for frame type - they are the same for RLP version 0, 1 and 2. */
typedef enum {
RLP_FT_X, /* Unknown. */
RLP_FT_U, /* Unnumbered frame. */
RLP_FT_S, /* Supervisory frame. */
RLP_FT_IS /* Information plus Supervisory (I+S) frame. */
} rlp_frame_type;
/* Define the various Unnumbered frame types. Numbering is bit reversed
relative to ETSI GSM 04.22 for easy parsing. */
typedef enum {
RLP_U_SABM = 0x07, /* Set Asynchronous Balanced Mode. */
RLP_U_UA = 0x0c, /* Unnumbered Acknowledge. */
RLP_U_DISC = 0x08, /* Disconnect. */
RLP_U_DM = 0x03, /* Disconnected Mode. */
RLP_U_NULL = 0x0f, /* Null information. */
RLP_U_UI = 0x00, /* Unnumbered Information. */
RLP_U_XID = 0x17, /* Exchange Identification. */
RLP_U_TEST = 0x1c, /* Test. */
RLP_U_REMAP = 0x11 /* Remap. */
} rlp_uframe_type;
/* Define supervisory frame field. */
typedef enum {
RLP_S_RR = 0x00, /* Receive Ready. */
RLP_S_REJ = 0x02, /* Reject. */
RLP_S_RNR = 0x01, /* Receive Not Ready. */
RLP_S_SREJ = 0x03 /* Selective Reject. */
} rlp_sframe_field;
/* Used for CurrentFrameType. */
typedef enum {
RLP_FT_U_SABM = 0x00,
RLP_FT_U_UA,
RLP_FT_U_DISC,
RLP_FT_U_DM,
RLP_FT_U_NULL,
RLP_FT_U_UI,
RLP_FT_U_XID,
RLP_FT_U_TEST,
RLP_FT_U_REMAP,
RLP_FT_S_RR,
RLP_FT_S_REJ,
RLP_FT_S_RNR,
RLP_FT_S_SREJ,
RLP_FT_SI_RR,
RLP_FT_SI_REJ,
RLP_FT_SI_RNR,
RLP_FT_SI_SREJ,
RLP_FT_BAD
} rlp_frame_types;
/* Frame definition for TCH/F9.6 frame. */
typedef struct {
unsigned char Header[2];
unsigned char Data[25];
unsigned char FCS[3];
} gn_rlp_f96_frame;
/* Header data "split up" for TCH/F9.6 frame. */
typedef struct {
unsigned char Ns; /* Send sequence number. */
unsigned char Nr; /* Receive sequence number. */
unsigned char M; /* Unumbered frame type. */
unsigned char S; /* Status. */
int PF; /* Poll/Final. */
int CR; /* Command/Response. */
rlp_frame_type Type; /* Frame type. */
} rlp_f96_header;
/* RLP User requests */
typedef struct {
int Conn_Req;
int Attach_Req;
int Conn_Req_Neg;
int Reset_Resp;
int Disc_Req;
} rlp_user_request_store;
typedef enum {
Conn_Req,
Attach_Req,
Conn_Req_Neg,
Reset_Resp,
Disc_Req
} rlp_user_requests;
typedef enum {
Conn_Ind,
Conn_Conf,
Disc_Ind,
Reset_Ind,
Data, /* FIXME: This should really be called RLP_Data, otherwise it hogs name "Data"! */
StatusChange,
GetData
} rlp_user_inds;
/* RLP (main) states. See GSM specification 04.22 Annex A, Section A.1.1. */
typedef enum {
RLP_S0, /* ADM and Detached */
RLP_S1, /* ADM and Attached */
RLP_S2, /* Pending Connect Request */
RLP_S3, /* Pending Connect Indication */
RLP_S4, /* ABM and Connection Established */
RLP_S5, /* Disconnect Initiated */
RLP_S6, /* Pending Reset Request */
RLP_S7, /* Pending Reset Indication */
RLP_S8 /* Error */
} rlp_state;
/* RLP specification defines several states in which variables can be. */
typedef enum {
_idle=0,
_send,
_wait,
_rcvd,
_ackn,
_rej,
_srej
} rlp_state_variable;
/* RLP Data */
typedef struct {
unsigned char Data[25];
rlp_state_variable State;
} rlp_data;
/* Prototypes for functions. */
void rlp_f96_frame_display(gn_rlp_f96_frame *frame);
void rlp_f96_header_decode(gn_rlp_f96_frame *frame, rlp_f96_header *header);
void rlp_xid_display(unsigned char *frame);
void rlp_initialise(int (*rlp_send_function)(gn_rlp_f96_frame *frame, int out_dtx), int (*rlp_passup)(rlp_user_inds ind, unsigned char *buffer, int length));
void rlp_link_vars_init(void);
void rlp_user_request_set(rlp_user_requests type, int value);
void rlp_send(char *buffer, int length);
#endif /* _gnokii_rlp_common_h */
|