mmsengine/mmsserver/inc/mmsservercommon.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *     Common constants and other definitions needed by several classes
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MMSSERVERCOMMON_H
       
    22 #define MMSSERVERCOMMON_H
       
    23 
       
    24 #ifdef _DEBUG
       
    25 #undef _NO_MMSS_LOGGING_
       
    26 #endif
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h>
       
    30 #include <msvstd.h>
       
    31 #include "mmsversion.h"  // current MMS encapsulation version
       
    32 
       
    33 #ifndef _NO_MMSS_LOGGING_
       
    34 // c:\logs\mmss
       
    35 _LIT( KMmsDefaultLogDirectory, "\x43:\\logs\\mmss\\" ); 
       
    36 class TMmsLogger
       
    37     {
       
    38     public:
       
    39         static void Log(TRefByValue<const TDesC> aFmt,...);
       
    40     };
       
    41 #endif
       
    42 
       
    43 #define KMMSMAXTIDLENGTH 16  //This cannot be made a variable, must be define
       
    44 
       
    45 // CONSTANTS
       
    46 const TUint8 KMmsMajorVersionMask = 0x70; // binary 0111 0000
       
    47 const TUint8 KMmsMinorVersionMask = 0x0F; // binary 0000 1111
       
    48 
       
    49 // Symbian's CMsgActive objects are run with slightly higher priority than
       
    50 // normal (i.e. '1'). Mms follows this principle in the most important AOs.
       
    51 const TInt KMmsActiveObjectPriority = CActive::EPriorityStandard + 1;
       
    52 
       
    53 // buffer size for chunked encoding - exact size will be adjusted later
       
    54 // small size used for tests
       
    55 const TInt KMmsChunkedBufferSize = 10*1024;
       
    56 //use value 1024 to test tiny chunks
       
    57 
       
    58 // Assigned numbers and assigned values for MMS headers
       
    59 // assigned numbers, enoced as short integers
       
    60 const TUint8 KMmsAssignedBcc = 0x01 | 0x80;
       
    61 const TUint8 KMmsAssignedCc  = 0x02 | 0x80;
       
    62 const TUint8 KMmsAssignedContentLocation = 0x03 | 0x80;
       
    63 const TUint8 KMmsAssignedContentType = 0x04 | 0x80;
       
    64 const TUint8 KMmsAssignedDate = 0x05 | 0x80;
       
    65 const TUint8 KMmsAssignedDeliveryReport = 0x06 | 0x80;
       
    66 const TUint8 KMmsAssignedDeliveryTime = 0x07 | 0x80;
       
    67 const TUint8 KMmsAssignedExpiry = 0x08 | 0x80;
       
    68 const TUint8 KMmsAssignedFrom = 0x09 | 0x80;
       
    69 const TUint8 KMmsAssignedMessageClass = 0x0A | 0x80;
       
    70 const TUint8 KMmsAssignedMessageId = 0x0B | 0x80;
       
    71 const TUint8 KMmsAssignedMessageType = 0x0C | 0x80;
       
    72 const TUint8 KMmsAssignedMmsVersion = 0x0D | 0x80;
       
    73 const TUint8 KMmsAssignedMessageSize = 0x0E | 0x80;
       
    74 const TUint8 KMmsAssignedPriority = 0x0F | 0x80;
       
    75 const TUint8 KMmsAssignedReadReply = 0x10 | 0x80;
       
    76 const TUint8 KMmsAssignedReportAllowed = 0x11 | 0x80;
       
    77 const TUint8 KMmsAssignedResponseStatus = 0x12 | 0x80;
       
    78 const TUint8 KMmsAssignedResponseText = 0x13 | 0x80;
       
    79 const TUint8 KMmsAssignedSenderVisibility = 0x14 | 0x80;
       
    80 const TUint8 KMmsAssignedStatus = 0x15 | 0x80;
       
    81 const TUint8 KMmsAssignedSubject = 0x16 | 0x80;
       
    82 const TUint8 KMmsAssignedTo = 0x17 | 0x80;
       
    83 const TUint8 KMmsAssignedTID = 0x18 | 0x80;
       
    84 // new for MMS encapsulation version 1.1
       
    85 const TUint8 KMmsAssignedRetrieveStatus = 0x19 | 0x80;
       
    86 const TUint8 KMmsAssignedRetrieveText = 0x1A | 0x80;
       
    87 const TUint8 KMmsAssignedReadStatus = 0x1B | 0x80;
       
    88 const TUint8 KMmsAssignedReplyCharging = 0x1C | 0x80;
       
    89 const TUint8 KMmsAssignedReplyChargingDeadline = 0x1D | 0x80;
       
    90 const TUint8 KMmsAssignedReplyChargingID = 0x1E | 0x80;
       
    91 const TUint8 KMmsAssignedReplyChargingSize = 0x1F | 0x80;
       
    92 const TUint8 KMmsAssignedPreviouslySentBy = 0x20 | 0x80;
       
    93 const TUint8 KMmsAssignedPreviouslySentDate = 0x21 | 0x80;
       
    94 // new for MMS encapsulation version 1.2
       
    95 const TUint8 KMmsAssignedMmsStore = 0x22 | 0x80; // store to Mmbox
       
    96 const TUint8 KMmsAssignedMMState = 0x23 | 0x80;
       
    97 const TUint8 KMmsAssignedMMFlags = 0x24 | 0x80;
       
    98 const TUint8 KMmsAssignedStoreStatus = 0x25 | 0x80;
       
    99 const TUint8 KMmsAssignedStoreStatusText = 0x26 | 0x80;
       
   100 const TUint8 KMmsAssignedStored = 0x27 | 0x80;
       
   101 const TUint8 KMmsAssignedAttributes = 0x28 | 0x80;
       
   102 const TUint8 KMmsAssignedTotals = 0x29 | 0x80;
       
   103 const TUint8 KMmsAssignedMboxTotals = 0x2A | 0x80;
       
   104 const TUint8 KMmsAssignedQuotas = 0x2B | 0x80;
       
   105 const TUint8 KMmsAssignedMboxQuotas = 0x2C | 0x80;
       
   106 const TUint8 KMmsAssignedMessageCount = 0x2D | 0x80;
       
   107 const TUint8 KMmsAssignedContent = 0x2E | 0x80;
       
   108 const TUint8 KMmsAssignedStart = 0x2F | 0x80;
       
   109 const TUint8 KMmsAssignedAdditionalHeaders = 0x30 | 0x80;
       
   110 const TUint8 KMmsAssignedDistributionIndicator = 0x31 | 0x80;
       
   111 const TUint8 KMmsAssignedElementDescriptor = 0x32 | 0x80;
       
   112 const TUint8 KMmsAssignedLimit = 0x33 | 0x80;
       
   113 // new for MMS encapsulation version 1.3
       
   114 const TUint8 KMmsAssignedRecommendedRetrievalMode = 0x34 | 0x80;
       
   115 const TUint8 KMmsAssignedRecommendedRetrievalModeText = 0x35 | 0x80;
       
   116 const TUint8 KMmsAssignedStatusText = 0x36 | 0x80;
       
   117 const TUint8 KMmsAssignedApplicId = 0x37 | 0x80;
       
   118 const TUint8 KMmsAssignedReplyApplicId = 0x38 | 0x80;
       
   119 const TUint8 KMmsAssignedAuxApplicInfo = 0x39 | 0x80;
       
   120 const TUint8 KMmsAssignedContentClass = 0x3A | 0x80;
       
   121 const TUint8 KMmsAssignedDrmContent = 0x3B | 0x80;
       
   122 const TUint8 KMmsAssignedAdaptationAllowed = 0x3C | 0x80;
       
   123 const TUint8 KMmsAssignedReplaceId = 0x3D | 0x80;
       
   124 const TUint8 KMmsAssignedCancelId = 0x3E | 0x80;
       
   125 const TUint8 KMmsAssignedCancelStatus = 0x3F | 0x80;
       
   126 
       
   127 
       
   128 // Assigned numbers for application specific headers
       
   129 // these are not defined in the standard, but we define them
       
   130 // internally to avoid using text strings all around
       
   131 // We start allocation from top down to avoid overlap as
       
   132 // long as possible
       
   133 // We leave out the code that produces -1, as that is the mark
       
   134 // of an unrecognized header in our code.
       
   135 
       
   136 const TUint8 KMmsAssignedExtendedNotificationText = 0x7E | 0x80;
       
   137 const TUint8 KMmsAssignedExtendedNotificationEOL = 0x7D | 0x80;
       
   138 
       
   139 // Parameter name assignment
       
   140 // since MMS encapsulation version 1.2
       
   141 const TUint8 KMmsAssignedTopLevelContentType = 0x02 | 0x80;
       
   142 
       
   143 // Header encoding
       
   144 
       
   145 const TUint8 KMmsAbsoluteToken = 128;
       
   146 const TUint8 KMmsRelativeToken = 129;
       
   147 
       
   148 const TUint8 KMmsAddressPresentToken = 128;
       
   149 const TUint8 KMmsInsertAddressToken = 129;
       
   150 
       
   151 // The field assignements that are used in internal storage are in mmsconst.h
       
   152 // The codes in internal storage are the same as those used in actual decoding
       
   153 
       
   154 // status codes for X-Mms-Response-Status
       
   155 // X-Mms-Retrieve-Status has different mapping.
       
   156 const TUint8 KMmsStatusOk = 128;
       
   157 const TUint8 KMmsErrorUnspecified = 129;
       
   158 const TUint8 KMmsErrorServiceDenied = 130;
       
   159 const TUint8 KMmsErrorMessageFormatCorrupt = 131;
       
   160 const TUint8 KMmsErrorSendingAddressUnresolved = 132;
       
   161 const TUint8 KMmsErrorMessageNotFound = 133;
       
   162 const TUint8 KMmsErrorNetworkProblem = 134;
       
   163 const TUint8 KMmsErrorNoContentAccepted = 135;
       
   164 const TUint8 KMmsErrorUnsupportedMessage = 136;
       
   165 // new status codes for encapsulation version 1.1
       
   166 // transient errors
       
   167 const TUint8 KMmsErrorTransientFailure = 192; // 0xC0
       
   168 const TUint8 KMmsErrorTransientSendingAddressUnresolved = 193;
       
   169 const TUint8 KMmsErrorTransientMessageNotFound = 194;
       
   170 const TUint8 KMmsErrorTransientNetworkProblem = 195;
       
   171 const TUint8 KMmsErrorTransientPartialSuccess = 196; // since enc 1.2
       
   172 // permanent errors
       
   173 const TUint8 KMmsErrorPermanentFailure = 224; // 0xE0
       
   174 const TUint8 KMmsErrorPermanentServiceDenied = 225;
       
   175 const TUint8 KMmsErrorPermanentMessageFormatCorrupt = 226;
       
   176 const TUint8 KMmsErrorPermanentSendingAddressUnresolved = 227;
       
   177 const TUint8 KMmsErrorPermanentMessageNotFound = 228;
       
   178 const TUint8 KMmsErrorPermanentContentNotAccepted = 229;
       
   179 const TUint8 KMmsErrorPermanentReplyChargingLimitationsNotMet = 230;
       
   180 const TUint8 KMmsErrorPermanentReplyChargingRequestNotAccepted = 231;
       
   181 const TUint8 KMmsErrorPermanentReplyChargingForwardingDenied = 232;
       
   182 const TUint8 KMmsErrorPermanentReplyChargingNotSupported = 233;
       
   183 const TUint8 KMmsErrorPermanentAddressHidingNotSupported = 234; // since enc 1.2
       
   184 const TUint8 KMmsErrorPermanentLackOfPrepaid = 235; // since enc. 1.3
       
   185 
       
   186 // status codes for X-Mms-Response-Status
       
   187 // KMmsStatusOk: 128; // same as for X-Mms-Response-Status
       
   188 // KMmsErrorTransientFailure:  // 0xC0 // same as for X-Mms-Response-Status
       
   189 const TUint8 KMmsErrorReceiveTransientMessageNotFound = 193;
       
   190 const TUint8 KMmsErrorReceiveTransientNetworkProblem = 194;
       
   191 // KMmsErrorPermanentFailure: 224; // 0xE0 // same as for X-Mms-Response-Status
       
   192 // KMmsErrorPermanentServiceDenied: 225; // same as for X-Mms-Response-Status
       
   193 const TUint8 KMmsErrorReceivePermanentMessageNotFound = 226;
       
   194 const TUint8 KMmsErrorReceivePermanentContentUnsupported = 227;
       
   195 
       
   196 // status codes for X-Mms-Store-Status
       
   197 // KMmsStatusOk: 128; // same as for X-Mms-Response-Status
       
   198 // KMmsErrorTransientFailure: 192; // 0xC0 // same as for X-Mms-Response-Status
       
   199 const TUint8 KMmsErrorStoreStatusTransientNetworkProblem = 193;
       
   200 // KMmsErrorPermanentFailure: 224; // 0xE0 // same as for X-Mms-Response-Status
       
   201 // KMmsErrorPermanentServiceDenied: 225; // same as for X-Mms-Response-Status
       
   202 // KMmsErrorPermanentMessageFormatCorrupt: 226; // same as for X-Mms-Response-Status
       
   203 const TUint8 KMmsErrorStoreStatusPermanentMessageNotFound = 227;
       
   204 const TUint8 KMmsErrorStoreStatusPermanentMmboxFull = 228;
       
   205 
       
   206 // masks for separating transient and permanent ranges
       
   207 const TUint8 KMmsErrorRangeMask = 0x60; // 0110 0000
       
   208 const TUint8 KMmsErrorTransient = 0x40; // 0010 0000 // all transient errors have this bit set
       
   209 const TUint8 KMmsErrorPermanent = 0x60; // 0110 0000 // all permanent errors have these bits set
       
   210 
       
   211 // misc bytes needed in encoding/decoding
       
   212 const TUint8 KMmsQuote = 127;
       
   213 const TUint8 KMmsNull = 0;
       
   214 
       
   215 _LIT( KMiuMau, "@" );
       
   216 _LIT8( KMmsPlmn, "/TYPE=PLMN" );
       
   217 _LIT8( KMmsIpv4, "/TYPE=IPv4" );
       
   218 _LIT8( KMmsIpv6, "/TYPE=IPv6" );
       
   219 
       
   220 _LIT16( KMmsPlmnu, "/TYPE=PLMN" );
       
   221 _LIT16( KMmsIpv4u, "/TYPE=IPv4" );
       
   222 _LIT16( KMmsIpv6u, "/TYPE=IPv6" );
       
   223 
       
   224 const TInt KMmsPlmnLength = 10;
       
   225 const TInt KMmsIpv4Length = 10;
       
   226 const TInt KMmsIPv6Length = 10;
       
   227 
       
   228 const TUint8 KMmsLengthQuote = 31;
       
   229 const TUint8 KMmsStringQuote = 34;
       
   230 
       
   231 // Mime content types and their assignments are defined in mmsconst.h
       
   232 
       
   233 // WSP well-known header field name assingments
       
   234 const TUint8 KWspContentLocation = 0x0E;
       
   235 const TUint8 KWspContentDisposition = 0x2E;
       
   236 // WSP well-known parameter assignments
       
   237 const TUint8 KWspQValue = 0x00; // value encoded as Uintvar.
       
   238 const TUint8 KWspCharset = 0x01;
       
   239 const TUint8 KWspName = 0x05;
       
   240 const TUint8 KWspFileName = 0x06;
       
   241 // parameters for multipart/related content type
       
   242 const TUint8 KWspRelatedType = 0x09;
       
   243 const TUint8 KWspStart = 0x0A;
       
   244 const TUint8 KWspStartInfo = 0x0B;
       
   245 const TUint8 KWspContentId = 0x40;
       
   246 const TUint8 KWspAttachment = 0x01;
       
   247 const TUint8 KWspInline = 0x02; // WSP 1.4 Only decode, never encode
       
   248 _LIT8( KWspContentIdString, "Content-ID" );
       
   249 _LIT8( KWspNameString, "Name" );
       
   250 _LIT8( KWspFilenameString, "Filename" );
       
   251 _LIT8( KWspProfileString, "Profile" );
       
   252 _LIT8( KWspAttachmentString, "Attachment" );
       
   253 _LIT8( KWspInlineString, "Inline" );
       
   254 _LIT8( KHTTPUtf8, "utf-8" );
       
   255 _LIT8( KHTTPEnglish, "en" );
       
   256 _LIT8( KCharset, "charset" );
       
   257 _LIT8( KMmsSeparateDeliveryOmaXHeader, "X-Oma-Drm-Separate-Delivery" );
       
   258 
       
   259 // WSP headers for transport
       
   260 // Accept: */*, Accept: application/vnd.wap.mms-message, Accept: application/vnd.wap.sic, Accept-Language: en, Accept-Charset: utf-8
       
   261 _LIT8( KMmsClientHeaders, "\x080\x080\x080\x061pplication/vnd.wap.mms-message\x000\x080\x061pplication/vnd.wap.sic\x000\x083\x099\x081\x0EA" );
       
   262 // static UAProf string not used: if UAProf not found in .ini file, the header is omitted
       
   263 _LIT8( KMmsUAProf, "\x0B5");
       
   264 
       
   265 // Null must be separate to support HTTP transpot, too
       
   266 _LIT8( KMmsMessageContentType, "application/vnd.wap.mms-message" );
       
   267 // Some gateway wants this before it is willing to send mms notifications
       
   268 _LIT8( KMmsWapSicContentType, "application/vnd.wap.sic" );
       
   269 _LIT8( KMmsWspHeaderUserAgent,"\x0A9" ); // assigned number only
       
   270 // Useragent is read from .ini file. If not found, old static string used
       
   271 _LIT8( KMmsDefaultUserAgent,"Nokia6630/1.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1" );
       
   272 
       
   273 // DATA TYPES
       
   274 
       
   275 // This is the state that will be used to indicate that
       
   276 // network operations are not allowed ( sending and receiving are suspended )
       
   277 // This must be one of the states defined in TMsvSendState enum list
       
   278 const TUint KMmsOffLineState = KMsvSendStateSuspended;
       
   279 
       
   280 const TUint16 KMmsPushId = 4; // this is our application id
       
   281 
       
   282 const TInt KMMSBufferExtra = 1024; // reserve a bit extra to allow inaccuracy in message size
       
   283 const TInt KMMSAttachmentExtra = 50; // extra for attachment headers.
       
   284 
       
   285 // The scheduling works without delays
       
   286 #ifdef __WINS__
       
   287 const TInt KMmsDelayInSeconds = 0;
       
   288 #else
       
   289 const TInt KMmsDelayInSeconds = 0;
       
   290 #endif //  __WINS__
       
   291 
       
   292 // This is more than what we need, but we are cautious
       
   293 const TInt KExtraSpaceForDirectionalityMarkers = 6;
       
   294 
       
   295 // Garbage collection reason flags
       
   296 // phone booted (or mmswatcher started for some other reason)
       
   297 const TUint32 KMmsReasonBoot = 0x00000001;
       
   298 // message store location has changed
       
   299 const TUint32 KMmsReasonMessageStoreChanged = 0x00000002;
       
   300 // network operations have become allowed again (after being forbidden)
       
   301 const TUint32 KMmsReasonNetworkAllowed = 0x00000004;
       
   302 // backup/restore operation has ended
       
   303 const TUint32 KMmsReasonBackupEnded = 0x00000008;
       
   304 // if media available/media unavailable events have been encountered
       
   305 // without any other apparent reason, the reason code will be hotswap
       
   306 const TUint32 KMmsReasonHotswap = 0x00000010;
       
   307 // User has changed system time
       
   308 // This event is needed in case the user moves the time too much towards future
       
   309 // If time is changed too much, task scheduler does not reschedule the task
       
   310 const TUint32 KMmsReasonEnvironmentTimeChanged = 0x00000020;
       
   311 
       
   312 const TInt KMmsExtendedMessageComplete = 0x31;
       
   313 
       
   314 const TInt KMmsMaxLogStringLength = 200;
       
   315 const TInt KMmsIntegerSize = 32;
       
   316 
       
   317 const TInt KMmsLowestAscii = 32; // 0x20
       
   318 const TInt KMmsHighestAscii = 127; // 0x7F
       
   319 
       
   320 // This is the maximum length for Mms Content location header in conformance specs.
       
   321 // We use it as maximum filename length, too, so that we always have room for path.
       
   322 // If we allow filenames up to maximum Symbian buffer length, there will be no room
       
   323 // for attachment path, and attachment file creation will fail.
       
   324 const TInt KMmsMaxFileName = 100; 
       
   325 
       
   326 // FUNCTION PROTOTYPES
       
   327 
       
   328 // FORWARD DECLARATIONS
       
   329 
       
   330 #endif      // MMSSERVERCOMMON_H
       
   331             
       
   332 // End of File