Found in "gnokii-working" directory, some November-patches version
[gnokii.git] / include / gsm-sms.h
index fac18b9..37190ae 100644 (file)
 /*
 
+  $Id$
+
   G N O K I I
 
   A Linux/Unix toolset and driver for Nokia mobile phones.
 
+  Copyright (C) 2001 Pawe³ Kot <pkot@linuxnews.pl>
+
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
+  Include file for SMS library.
+
+  $Log$
+  Revision 1.1.1.6  2002/04/03 00:08:20  short
+  Found in "gnokii-working" directory, some November-patches version
+
+  Revision 1.1  2001/11/08 16:23:20  pkot
+  New version of libsms. Not functional yet, but it reasonably stable API.
+
+  Revision 1.1  2001/07/09 23:06:26  pkot
+  Moved sms.* files from my hard disk to CVS
+
+
 */
 
-#ifndef __gsm_sms_h
-#define __gsm_sms_h
+#ifndef __gnokii_sms_h_
+#define __gnokii_sms_h_
 
-#include "gsm-common.h"
-#include "gsm-datetime.h"
+#include "misc.h"
+#include "gsm-error.h"
 
-/* This data-type is used to specify the type of the number. See the official
-   GSM specification 03.40, version 5.3.0, section 9.1.2.5, page 33. */
-typedef enum {
-  GNT_UNKNOWN=0x81,       /* Unknown number */
-  GNT_INTERNATIONAL=0x91, /* International number */
-  GNT_ALPHANUMERIC=0xD0   /* Alphanumeric number */
-} GSM_NumberType;
+/* Maximum length of SMS center name */
 
-/* For folder table */
-typedef struct {
-  int smsnum;
-  u8 folder;
-  int location;
-//future use  GSM_SMSMessage *message;
-} GSM_SMS2Foldertable;
+#define GSM_MAX_SMS_CENTER_NAME_LENGTH (20)
 
-/* This data type is used to hold the current SMS status. */
-typedef struct {
-  int UnRead;                           /* The number of unread messages */
-  int Number;                           /* The number of messages */
-  GSM_SMS2Foldertable foldertable[255]; /* for 6210/7110 */
-} GSM_SMSStatus;
+/* Limits of SMS messages. */
 
-/* Define datatype for SMS Message Type */
-typedef enum {
-  GST_SMS,
-  GST_DR, /* Delivery Report */
-  GST_UN  /* Unknown */
-} GSM_SMSMessageType;
+#define GSM_MAX_SMS_CENTER_LENGTH  (40)
+#define GSM_MAX_SENDER_LENGTH      (40)
+#define GSM_MAX_DESTINATION_LENGTH (40)
 
-#define GST_INBOX       0;    /* Mobile Terminated (MT) message - Inbox message  */
-#define GST_OUTBOX      1;    /* Mobile Originated (MO) message - Outbox message */
-#define GST_7110_INBOX  0x08; /* Inbox in 6210/7110 */
-#define GST_7110_OUTBOX 0x10; /* Outbox in 6210/7110 */
+#define GSM_MAX_SMS_LENGTH         (160)
+#define GSM_MAX_8BIT_SMS_LENGTH    (140)
 
-/* Datatype for SMS status */
-typedef enum {
-  GSS_SENTREAD       = 0x01, /* Sent or read message */
-  GSS_NOTSENTREAD    = 0x03, /* Not sent or not read message */
-  GSS_UNKNOWN       = 0x05, /* RTH FIXME: ? */
-  GSS_TEMPLATE      = 0x07  /* Template ? */
-} GSM_SMSMessageStatus;
+#define SMS_MAX_ADDRESS_LENGTH      (40)
 
-/* SMS Messages sent as... */
-typedef enum {
-  GSMF_Text   = 0x00, /* Plain text message. */
-  GSMF_Fax    = 0x22, /* Fax message. */
-  GSMF_Voice  = 0x24, /* Voice mail message. */
-  GSMF_ERMES  = 0x25, /* ERMES message. */
-  GSMF_Paging = 0x26, /* Paging. */
-  GSMF_UCI    = 0x2d, /* Email message in 8110i. */
-  GSMF_Email  = 0x32, /* Email message. */
-  GSMF_X400   = 0x31  /* X.400 message. */
-} GSM_SMSMessageFormat;
+/* FIXME: what value should be here? (Pawel Kot) */
+//#define GSM_MAX_USER_DATA_HEADER_LENGTH (10)
+#define SMS_MAX_UDH_HEADER_NUMBER 10
 
-/* Validity of SMS Messages. */
-/* Ready values for TP-VP. Don't give them for function packing SMS validity
-   (creating TP-VP from validity value in minutes) */
-typedef enum {
-  GSMV_1_Hour   = 0x0b,
-  GSMV_6_Hours  = 0x47,
-  GSMV_24_Hours = 0xa7,
-  GSMV_72_Hours = 0xa9,
-  GSMV_1_Week   = 0xad,
-  GSMV_Max_Time = 0xff
-} GSM_SMSMessageValidity;
-
-/* 7 bit SMS Coding type */
-typedef enum {
-  GSM_Coding_Unicode = 0x01,
-  GSM_Coding_Default = 0x02,
-  GSM_Coding_8bit    = 0x03
-} GSM_Coding_Type;
+/*** MEMORY INFO ***/
 
-/* Define datatype for SMS Message Center */
 typedef struct {
-  int No;                                          /* Number of the SMSC in the phone memory. */
-  char Name[GSM_MAX_SMS_CENTER_NAME_LENGTH];       /* Name of the SMSC. */
-  GSM_SMSMessageFormat Format;                     /* SMS is sent as text/fax/paging/email. */
-  GSM_SMSMessageValidity Validity;                 /* Validity of SMS Message. */
-  char Number[GSM_MAX_SMS_CENTER_LENGTH];          /* Number of the SMSC. */
-  char DefaultRecipient[GSM_MAX_RECIPIENT_LENGTH]; /* Number of default recipient */
-} GSM_MessageCenter;
+       int Unread; /* Number of unread messages */
+       int Number; /* Number of all messages */
+} GSM_SMSMemoryStatus;
+
+/*** DATE AND TIME ***/
 
-/* Define datatype for Cell Broadcast message */
 typedef struct {
-  int Channel;                                      /* channel number */
-  char Message[GSM_MAX_CB_MESSAGE + 1];
-  int New;
-} GSM_CBMessage;
+       int Year;          /* The complete year specification - e.g. 1999. Y2K :-) */
+       int Month;           /* January = 1 */
+       int Day;
+       int Hour;
+       int Minute;
+       int Second;
+       int Timezone;      /* The difference between local time and GMT */
+} SMS_DateTime;
+
+/*** USER DATA HEADER ***/
 
 /* types of User Data Header */
 typedef enum {
-  GSM_NoUDH,
-  GSM_ConcatenatedMessages,
-  GSM_OpLogo,
-  GSM_CallerIDLogo,
-  GSM_RingtoneUDH,
-  GSM_EnableVoice,
-  GSM_DisableVoice,
-  GSM_EnableEmail,
-  GSM_DisableEmail,
-  GSM_EnableFax,
-  GSM_DisableFax,
-  GSM_VoidSMS,
-  GSM_HangSMS,
-  GSM_BugSMS,
-  GSM_UnknownUDH, //Gnokii doesn't know this UDH
-  GSM_WAPBookmarkUDH,
-  GSM_WAPBookmarkUDHLong,
-  GSM_WAPSettingsUDH,
-  GSM_CalendarNoteUDH,
-  GSM_CalendarNoteUDH2,
-  GSM_PhonebookUDH,
-  GSM_ProfileUDH,
-} GSM_UDH;
-
-/* Define datatype for SMS messages, used for getting SMS messages from the
-   phones memory. */
-typedef struct {
-  GSM_Coding_Type Coding;
-  GSM_DateTime Time;                            /* Date of reception/response of messages. */
-  GSM_DateTime SMSCTime;                        /* Date of SMSC response if DeliveryReport messages. */
-  int Length;                                    /* Length of the SMS message. */
-  int Validity;                                  /* Validity Period of the SMS message. */
-  GSM_UDH UDHType;                               /* If UDH is present - type of UDH */
-  unsigned char UDH[GSM_MAX_USER_DATA_HEADER_LENGTH]; /* If UDH is present - content of UDH */
-  unsigned char MessageText[GSM_MAX_SMS_LENGTH + 1];  /* Room for null term. */
-  GSM_MessageCenter MessageCenter;               /* SMS Center. */
-  char Sender[GSM_MAX_SENDER_LENGTH + 1];        /* Sender of the SMS message. */
-  char Destination[GSM_MAX_DESTINATION_LENGTH+1];/* Destination of the message. */
-  int MessageNumber;                             /* Location in the memory, where SMS is saved */
-  GSM_MemoryType MemoryType;                     /* Type of memory message is stored in. */
-  GSM_SMSMessageType Type;                       /* Type of the SMS message */
-  GSM_SMSMessageStatus Status;                   /* Status of the SMS message */
-  int Class;                                     /* Class Message: 0, 1, 2, 3 or none; see GSM 03.38 */
-  bool Compression;                              /* Indicates whether SMS contains compressed data */
-  int Location;                                  /* Location in the memory, when save SMS */
-  bool ReplyViaSameSMSC;                         /* Indicates whether "Reply via same center" is set */
-  int folder;                                    /* Folder: 0-Inbox,1-Outbox, etc. */
-  bool SMSData;                                 /* if folder contains sender, SMSC number and sending date */
-  unsigned char Name[25+1];                      /* Name in Nokia 6210/7110, etc. Ignored in other */
-} GSM_SMSMessage;
+       SMS_NoUDH                = 0x00,
+       SMS_ConcatenatedMessages = 0x01,
+       SMS_OpLogo               = 0x02,
+       SMS_CallerIDLogo         = 0x03,
+       SMS_Ringtone             = 0x04,
+       SMS_VoiceMessage         = 0x05,
+       SMS_FaxMessage           = 0x06,
+       SMS_EmailMessage         = 0x07,
+       SMS_OtherMessage         = 0x08,
+       SMS_UnknownUDH           = 0x09
+} SMS_UDHType;
 
 typedef struct {
-  int number;
-  GSM_SMSMessage SMS[6];
-} GSM_MultiSMSMessage;
+       SMS_UDHType Type;
+       union {
+               struct {
+                       unsigned short ReferenceNumber;
+                       unsigned short MaximumNumber;
+                       unsigned short CurrentNumber;
+               } ConcatenatedShortMessage; /* SMS_ConcatenatedMessages */
+               struct {
+                       bool Store;
+                       unsigned short MessageCount;
+               } SpecialSMSMessageIndication; /* SMS_VoiceMessage, SMS_FaxMessage, SMS_EmailMessage, SMS_OtherMessage */
+               struct {
+                       char NetworkCode[6];
+//                     ...
+               } Logo; /* SMS_OpLogo, SMS_CallerIDLogo */
+               struct {
+//                     ...
+               } Ringtone; /* SMS_Ringtone */
+       } u;
+} SMS_UDHInfo;
 
-/* Maximal number of SMS folders */
-/* #define MAX_SMS_FOLDERS 10 */
-#define MAX_SMS_FOLDERS 24
+typedef enum {
+       SMS_PID, /* Set Protocol Identifier to `Return Call Message' */
+       SMS_DCS, /* Set Data Coding Scheme "to indicate the type of message waiting and whether there are some messages or no messages" */
+       SMS_UDH  /* Use User Data Header - Special SMS Message Indication; the maximium level of information, may not be supported by all phones */
+} SMS_MessageWaitingType;
 
-typedef struct {
-  char Name[15];     /* Name for SMS folder */
-  u8 locations[160]; /* locations of SMS messages in that folder (6210 specific) */
-  u8 number;         /* number of SMS messages in that folder*/
-} GSM_OneSMSFolder;
+/*** DATA CODING SCHEME ***/
 
-typedef struct {
-  GSM_OneSMSFolder Folder[MAX_SMS_FOLDERS];
-  u8 FoldersID[MAX_SMS_FOLDERS]; // ID specific for this folder and phone.
-                                // Used in internal functions. Do not use it.
-  u8 number; //number of SMS folders
-} GSM_SMSFolders;
-
-/* Identifiers for Smart Messaging 3.0 multipart SMS */
-#define SM30_ISOTEXT      0 // ISO 8859-1 text
-#define SM30_UNICODETEXT  1
-#define SM30_OTA          2
-#define SM30_RINGTONE     3                     
-#define SM30_PROFILENAME  4
-#define SM30_SCREENSAVER  6
-
-/* TP-Message-Type-Indicator */
-/* See GSM 03.40 version 6.1.0 Release 1997 Section 9.2.3.1 */
-typedef enum {                 
-       SMS_Deliver = 0x00, /* when we save SMS in Inbox */
-       SMS_Deliver_Report, 
-       SMS_Status_Report,  /* Delivery Report received by phone */
-       SMS_Command,
-       SMS_Submit,         /* when we send SMS or save it in Outbox */
-       SMS_Submit_Report  
-} SMS_MessageType;
+typedef enum {
+       SMS_GeneralDataCoding,
+       SMS_MessageWaiting
+} SMS_DataCodingSchemeType;
 
-/* Structure to hold UDH Header */
-typedef struct {
-  GSM_UDH UDHType;     /* Type */
-  int Length;          /* Length */
-  unsigned char *Text; /* Text */
-} GSM_UDHHeader;
+typedef enum {
+       SMS_DefaultAlphabet = 0x00,
+       SMS_8bit            = 0x01,
+       SMS_UCS2            = 0x02
+} SMS_AlphabetType;
+
+typedef enum {
+       SMS_VoiceMail = 0x00,
+       SMS_Fax       = 0x01,
+       SMS_Email     = 0x02,
+       SMS_Text      = 0x03,
+       SMS_Other     = 0x04
+} SMS_IndicationType;
 
 typedef struct {
-  unsigned char MessageText[GSM_MAX_SMS_LENGTH + 1];
-    /* TP-User-Data. See GSM 03.40 section 9.2.3.24. Room for null term. */
+       SMS_DataCodingSchemeType Type;
+       union {
+               struct {
+                       unsigned short Class; /* 0 - no class
+                                                1 - Class 0
+                                                2 - Class 1
+                                                3 - Class 2
+                                                4 - Class 3 */
+                       bool Compressed;
+                       SMS_AlphabetType Alphabet;
+               } General;
+               struct {
+                       bool Discard;
+                       SMS_AlphabetType Alphabet; /* ucs16 not supported */
+                       bool Active;
+                       SMS_IndicationType Type;
+               } MessageWaiting;
+       } u;
+} SMS_DataCodingScheme;
+
+/*** VALIDITY PERIOD ***/
 
-  unsigned char Number[GSM_MAX_SENDER_LENGTH + 1];
- /*In SMS-Deliver       TP-Originating-Address.See GSM 03.40 section 9.2.3.7 */
- /*In SMS-Submit        TP-Destination-Address.See GSM 03.40 section 9.2.3.8 */
- /*In SMS-Status-Report TP-Recipient-Address.  See GSM 03.40 section 9.2.3.14*/
+typedef enum {
+       SMS_NoValidityPeriod = 0x00,
+       SMS_EnhancedFormat   = 0x01,
+       SMS_RelativeFormat   = 0x02,
+       SMS_AbsoluteFormat   = 0x03
+} SMS_ValidityPeriodFormat;
 
-  unsigned char SMSCNumber[GSM_MAX_SMS_CENTER_LENGTH];
-    /* SMSC number */
+typedef enum {
+       SMS_EnhancedNoValidityPeriod  = 0x00,
+       SMS_EnhancedRelativeFormat    = 0x01,
+       SMS_EnhancedRelativeSeconds   = 0x02, /* Only one ocetet more is used */
+       SMS_EnhancedRelativeSemiOctet = 0x03  /* 3 octets contain relative time in hours, minutes and seconds in semi-octet representation */
+} SMS_EnhancedValidityPeriodType;
 
-  unsigned char TPPID;
-    /* TP-Protocol-Identifier. See GSM 03.40 section 9.2.3.9 */
+typedef struct {
+       bool extension; /* we need to set it to 0 at the moment; FIXME: how to handle `1' here? */
+       bool single_shot;
+       SMS_EnhancedValidityPeriodType type;
+       union {
+               unsigned short relative;
+               unsigned short seconds;
+               SMS_DateTime hms;
+       } period;
+} SMS_EnhancedValidityPeriod;
 
-  unsigned char TPDCS;
-    /* TP-Data-Coding-Scheme. See GSM 03.40 section 9.2.3.10 */
+/* Validity of SMS Messages. */
 
-  unsigned char DeliveryDateTime[7];
- /* For SMS-Submit        TP-Validity-Period. See GSM 03.40 section 9.2.3.12 */
- /* For SMS-Status-Report TP-Discharge Time.  See GSM 03.40 section 9.2.3.13 */
+typedef enum {
+        SMS_V1H   = 0x0b,
+        SMS_V6H   = 0x47,
+        SMS_V24H  = 0xa7,
+        SMS_V72H  = 0xa9,
+        SMS_V1W   = 0xad,
+        SMS_VMax  = 0xff
+} SMS_ValidityPeriod;
 
-  unsigned char SMSCDateTime[7];
-    /* TP-Service-Centre-Time-Stamp in SMS-Status-Report.
-       See GSM 03.40 section 9.2.3.11 */
+typedef struct {
+       SMS_ValidityPeriodFormat VPF;
+       union {
+               SMS_EnhancedValidityPeriod Enhanced;
+               SMS_ValidityPeriod Relative; /* 8 bit */
+               SMS_DateTime Absolute;
+       } u;
+} SMS_MessageValidity;
 
-  unsigned char TPStatus;
-    /* TP-Status in SMS-Status-Report. See GSM 03.40 section 9.2.3.15 */
 
-  unsigned char TPUDL;
-    /* TP-User-Data-Length. See GSM 03.40 section 9.2.3.16 */
+/*** MESSAGE CENTER ***/
 
-  unsigned char TPVP;
-    /* TP-Validity Period in SMS-Submit. See GSM 03.40 section 9.2.3.12 */
+typedef struct {
+       int                     No;                                     /* Number of the SMSC in the phone memory. */
+       char                    Name[GSM_MAX_SMS_CENTER_NAME_LENGTH];   /* Name of the SMSC. */
+       SMS_IndicationType      Format;                                 /* SMS is sent as text/fax/paging/email. */
+       SMS_ValidityPeriod      Validity;                               /* Validity of SMS Message. */
+       char                    Number[GSM_MAX_SMS_CENTER_LENGTH];      /* Number of the SMSC. */
+       char                    Recipient[GSM_MAX_SMS_CENTER_LENGTH];   /* Number of the default recipient. */
+} SMS_MessageCenter;
 
-  unsigned char TPMR;
-    /* TP-Message Reference in SMS-Submit. See GSM 03.40 section 9.2.3.6 */
 
-  unsigned char firstbyte;
-    /* Byte contains in SMS-Deliver:
-       TP-Message-Type-Indicator     (2 bits) See GSM 03.40 section 9.2.3.1
+/*** SHORT MESSAGE CORE ***/
 
-       TP-More-Messages-To-Send      (1 bit). See GSM 03.40 section 9.2.3.2
+/* This data-type is used to specify the type of the number. See the official
+   GSM specification 03.40, version 6.1.0, section 9.1.2.5, page 35-37. */
+typedef enum {
+       SMS_Unknown       = 0x81, /* Unknown number */
+       SMS_International = 0x91, /* International number */
+       SMS_National      = 0xa1, /* National number */
+       SMS_Network       = 0xb1, /* Network specific number */
+       SMS_Subscriber    = 0xc1, /* Subscriber number */
+       SMS_Alphanumeric  = 0xd0, /* Alphanumeric number */
+       SMS_Abbreviated   = 0xe1  /* Abbreviated number */
+} SMS_NumberType;
 
-       TP-Reply-Path                 (1 bit). See GSM 03.40 section 9.2.3.17
-       TP-User-Data-Header-Indicator (1 bit). See GSM 03.40 section 9.2.3.23
-       TP-Status-Report-Indicator    (1 bit). See GSM 03.40 section 9.2.3.4
+typedef struct {
+       SMS_NumberType type;
+       char number[SMS_MAX_ADDRESS_LENGTH];
+} SMS_Number;
+
+typedef enum {                     /* Bits meaning */
+       SMS_Deliver         = 0x00, /* 00 0 First 2 digits are taken from */
+       SMS_Delivery_Report = 0x01, /* 00 1 GSM 03.40 version 6.1.0 Release 1997 */
+       SMS_Submit          = 0x02, /* 01 0 */
+       SMS_Submit_Report   = 0x03, /* 01 1 */
+       SMS_Command         = 0x04, /* 10 0 mark a report */
+       SMS_Status_Report   = 0x05, /* 10 1 Section 9.2.3.1; 3rd digit is to */
+} SMS_MessageType;
 
-       Byte contains in SMS-Submit:
+typedef enum {
+       SMS_Enquiry            = 0x00, /* Enquiry relating to previosly submitted short message; sets SRR to 1 */
+       SMS_CancelStatusReport = 0x01, /* Cancel Status Report Request relating to previously submitted short message; sets SRR to 0 */
+       SMS_DeleteSM           = 0x02, /* Delete previousle submitted Short Message; sets SRR to 0 */
+       SMS_EnableStatusReport = 0x03  /* Enable Status Report Request relating to previously submitted short message; sets SRR to 0 */
+} SMS_CommandType;
 
-       TP-Message-Type-Indicator     (2 bits) See GSM 03.40 section 9.2.3.1
+typedef struct {
+       SMS_CommandType Type;
+} SMS_MessageCommand;
 
-       TP-Reject-Duplicates          (1 bit). See GSM 03.40 section
-       TP-Validity-Period-Format     (2 bits).See GSM 03.40 section 9.2.3.3
+/* Datatype for SMS status */
+typedef enum {
+       SMS_Read   = 0x01,
+       SMS_Unread = 0x03,
+       SMS_Sent   = 0x05,
+       SMS_Unsent = 0x07
+} SMS_MessageStatus;
 
-       TP-Reply-Path                 (1 bit). See GSM 03.40 section 9.2.3.17
-       TP-User-Data-Header-Indicator (1 bit). See GSM 03.40 section 9.2.3.23
-       TP-Status-Report-Request      (1 bit). See GSM 03.40 section 9.2.3.5 */
-} GSM_ETSISMSMessage;
+typedef enum {
+       SMS_XXX = 0x01
+} SMS_MemoryType;
+        
+/* Define datatype for SMS messages, describes precisely GSM Spec 03.40 */
+typedef struct {
+       /* Specification fields */
+       SMS_MessageType Type;                          /* Message Type Indicator - 2 bits (9.2.3.1) */
+       bool MoreMessages;                             /* More Messages to Send (9.2.3.2) */
+       bool ReplyViaSameSMSC;                         /* Reply Path (9.2.3.17) - `Reply via same centre' in the phone */
+       bool RejectDuplicates;                         /* Reject Duplicates (9.2.3.25) */
+       bool Report;                                   /* Status Report (9.2.3.4, 9.2.3.5 & 9.2.3.26) - `Delivery reports' in the phone */
+
+       unsigned short Number;                         /* Message Number - 8 bits (9.2.3.18) */
+       unsigned short Reference;                      /* Message Reference - 8 bit (9.2.3.6) */
+       unsigned short PID;                            /* Protocol Identifier - 8 bit (9.2.3.9) */
+       unsigned short ReportStatus;                   /* Status - 8 bit (9.2.3.15), Failure Cause (9.2.3.22) */
+       unsigned short Length;                         /* User Data Length (9.2.3.16), Command Data Length (9.2.3.20) */
+
+       SMS_MessageCenter MessageCenter;               /* SMSC Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */
+       SMS_Number RemoteNumber;                       /* Origination, destination, Recipient Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */
+       unsigned char MessageText[GSM_MAX_SMS_LENGTH]; /* User Data (9.2.3.24), Command Data (9.2.3.21) */
+       SMS_DataCodingScheme DCS;                      /* Data Coding Scheme (9.2.3.10) */
+       SMS_MessageValidity Validity;                  /* Validity Period Format & Validity Period (9.2.3.3 & 9.2.3.12) - `Message validity' in the phone */
+  
+       unsigned short UDH_No;                         /* Number of presend UDHs */
+       SMS_UDHInfo UDH[SMS_MAX_UDH_HEADER_NUMBER];    /* User Data Header Indicator & User Data Header (9.2.3.23 & 9.2.3.24) */
+
+       SMS_DateTime SMSCTime;                         /* Service Centre Time Stamp (9.2.3.11) */
+       SMS_DateTime Time;                             /* Discharge Time (9.2.3.13) */
+
+       /* Other fields */
+        SMS_MemoryType MemoryType;                     /* memoryType (for 6210/7110: folder indicator */
+       SMS_MessageStatus Status;                      /* Status of the message: sent/read or unsent/unread */
+
+//     SMS_CommandType Command;                       /* Command Type - 8 bits (9.2.3.19); FIXME: use it!!!! */
+//     unsigned char Parameter[???];                  /* Parameter Indicator (9.2.3.27); FIXME: how to use it??? */
+} GSM_SMSMessage;
 
-int   GSM_PackSemiOctetNumber  (u8 *Number, u8 *Output, bool semioctet);
-char *GSM_UnpackSemiOctetNumber(u8 *Number, bool semioctet);
+extern GSM_Error EncodePDUSMS(GSM_SMSMessage *SMS, char *frame);
+extern GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageLength);
+extern GSM_Error EncodeTextSMS();
+extern GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS);
 
-int GSM_UnpackEightBitsToSeven(int fillbits, int in_length, int out_length, unsigned char *input, unsigned char *output);
-int GSM_PackSevenBitsToEight  (int offset, unsigned char *input, unsigned char *output);
+/*** FOLDERS ***/
 
-GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_MessageType PDU, int *length);
-GSM_Error GSM_DecodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI);
+/* Maximal number of SMS folders */
+#define MAX_SMS_FOLDERS 24
 
-GSM_Error GSM_EncodeSMSDateTime(GSM_DateTime *DT, unsigned char *req);
+/* Datatype for SMS folders ins 6210/7110 */
+typedef struct {
+       char Name[15];     /* Name for SMS folder */
+       bool SMSData;      /* if folder contains sender, SMSC number and sending date */
+       u8 locations[160]; /* locations of SMS messages in that folder (6210 specific) */
+       u8 number;         /* number of SMS messages in that folder*/
+       u8 FolderID;       /* ID od fthe current folder */
+} SMS_Folder;
 
-GSM_Error GSM_DecodeETSISMSSubmitData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI);
+typedef struct {
+       SMS_Folder Folder[MAX_SMS_FOLDERS];
+       u8 FoldersID[MAX_SMS_FOLDERS]; /* ID specific for this folder and phone. */
+                                      /* Used in internal functions. Do not use it. */
+       u8 number;                     /* number of SMS folders */
+} SMS_FolderList;
 
-GSM_Error GSM_DecodeETSISMSStatusReportData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI);
+/*** CELL BROADCAST ***/
 
-void GSM_SetDefaultSMSData(GSM_SMSMessage *SMS);
-GSM_Error EncodeUDHHeader(char *text, GSM_UDH UDHType);
+#define GSM_MAX_CB_MESSAGE         (160)
 
-int GSM_MakeSinglePartSMS2(GSM_SMSMessage *SMS,
-    unsigned char *MessageBuffer,int cur, GSM_UDH UDHType, GSM_Coding_Type Coding);
-void GSM_MakeMultiPartSMS2(GSM_MultiSMSMessage *SMS,
-    unsigned char *MessageBuffer,int MessageLength, GSM_UDH UDHType, GSM_Coding_Type Coding);
+/* Define datatype for Cell Broadcast message */
+typedef struct {
+       int Channel;                                      /* channel number */
+       char Message[GSM_MAX_CB_MESSAGE + 1];
+       int New;
+} GSM_CBMessage;
 
-#endif /* __gsm_sms_h */
+#endif /* __gnokii_sms_h_ */