User Data Header (UDH) is a binary structure which may be present at the start of a short message in the Short Message Service in GSM. It does not contain any text, but it specifies how the message should be formatted and processed.
UDH can be used to form Concatenated SMS, to enrich the content of the message with colors, text formatting, small pictures and animations and simple music which are used in Enhanced Messaging Service (EMS), to convey port numbers which may cause start of an application in the mobile phone, which is used for Multimedia Messaging Service (MMS) or to indicate using of national language shift tables.[1]
UDH is defined in 3GPP 23.040 (originally GSM 03.40).[2]
Presence of User Data Header is indicated by the TP-UDHI (Transfer Layer Protocol User Data Header Indicator) bit - 6th bit of the first octet of the GSM 03.40 or 3GPP 23.040 message.
If UDH is present, it is at the beginning of the TP-UD (TP-User Data) field and it always starts with an UDHL (UDH Length) octet. The rest of UDH is a sequence of Tag-Length-Value triplets. The Tag is named Information-Element-Identifier (IEI) and is always 1 octet long, the Length field is always 1 octet long and it specifies the length of the Information Element Data.
UDH uses space intended for the message payload. The longer the UDH, the less space remains for the message text or other contents. When TP-UD contains seven-bit data, the length of TP-UD is given in septets (but UDHL is still in octets, so length in septets is (UDHL + 1) * 8 / 7) and the UDH is filled to a septet boundary with 0-6 zero bits. The next table shows how a TP-UD of a message in the GSM 7 bit default alphabet containing text 'Hi' with a predefined sound 'Chord high' will be encoded:
TP-UD Octet | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
---|---|---|---|---|---|---|---|---|
Value (hex) | 04 | 0B | 02 | 00 | 08 | 20 | D3 | |
Meaning | UDH Length | IEI: Predefined sound | IE Length | Position | Chord high | 6 lower bits of the 1st char + 2 fill bits | 7 lower bits of the 2nd char + 1 upper bit of the first char |
The total message length TP-UDL will be 8. (UDH has 8 * (1 + 4) = 40 bits, 2 bits is the padding as (40 + 2) / 7 = 6 without remainder, 2 * 7 = 14 bits for text; total TP-UD length is 40 + 2 + 14 = 56 bits = 7 octets = 8 septets.)
IEI (hex) | Meaning | Classification | Length | May repeat | |
---|---|---|---|---|---|
00 | Concatenated short messages, 8-bit reference number | SMS Control | 3 | no | |
01 | Special SMS Message Indication | SMS Control | 2 | yes | |
02 | Reserved | N/A | N/A | yes | |
03 | Not used to avoid misinterpretation as | N/A | N/A | yes | |
04 | Application port addressing scheme, 8 bit address | SMS Control | 2 | no | |
05 | Application port addressing scheme, 16 bit address | SMS Control | 4 | no | |
06 | SMSC Control Parameters | SMS Control | 1 | no | |
07 | UDH Source Indicator | SMS Control | 1 | yes | |
08 | Concatenated short message, 16-bit reference number | SMS Control | 4 | no | |
09 | SMS Control | 1-255 | yes | ||
0A | Text Formatting | EMS Control | 3-4 | yes | |
0B | Predefined Sound | EMS Content | 2 | yes | |
0C | User Defined Sound (iMelody max 128 bytes) | EMS Content | 2-129 | yes | |
0D | Predefined Animation | EMS Content | 2 | yes | |
0E | Large Animation (16*16 times 4 = 32*4 =128 bytes) | EMS Content | 129 | yes | |
0F | Small Animation (8*8 times 4 = 8*4 =32 bytes) | EMS Content | 33 | yes | |
10 | Large Picture (32*32 = 128 bytes) | EMS Content | 129 | yes | |
11 | Small Picture (16*16 = 32 bytes) | EMS Content | 33 | yes | |
12 | Variable Picture | EMS Content | 4-255 | yes | |
13 | User prompt indicator | EMS Control | 1 | yes | |
14 | Extended Object | EMS Content | 7-255 | yes | |
15 | Reused Extended Object | EMS Control | 3 | yes | |
16 | Compression Control | EMS Control | 3-255 | no | |
17 | Object Distribution Indicator | EMS Control | 2 | yes | |
18 | Standard WVG object | EMS Content | 1-255 | yes | |
19 | Character Size WVG object | EMS Content | 1-255 | yes | |
1A | Extended Object Data Request Command | EMS Control | 0-255 | no | |
1B | Reserved for future EMS features | N/A | 0-255 | yes | |
1C | Reserved for future EMS features | N/A | 0-255 | yes | |
1D | Reserved for future EMS features | N/A | 0-255 | yes | |
1E | Reserved for future EMS features | N/A | 0-255 | yes | |
1F | Reserved for future EMS features | N/A | 0-255 | yes | |
20 | RFC 822 E-Mail Header | SMS Control | 1 | no | |
21 | Hyperlink format element | SMS Control | 0-255 | yes | |
22 | Reply Address Element | SMS Control | 1-255 | no | |
23 | Enhanced Voice Mail Information | SMS Control | 0-255 | no | |
24 | National Language Single Shift | SMS Control | 1 | no | |
25 | National Language Locking Shift | SMS Control | 1 | no | |
26 | Filler | SMS Control | 0-255 | yes | |
27 – 6F | Reserved for future use | N/A | 0-255 | N/A | |
70 – 7F | (U)SIM Toolkit Security Headers | SMS Control | 0-255 | ? | |
80 – 9F | SME to SME specific use | SMS Control | 0-255 | ? | |
A0 – BF | Reserved for future use | N/A | 0-255 | ? | |
C0 – DF | SC specific use | SMS Control | 0-255 | ? | |
E0 – FF | Reserved for future use | N/A | 0-255 | ? |
The UDH is used in other protocols for short message transport - Short Message Peer-to-Peer (SMPP), Universal Computer Protocol (UCP) and in WEMT teleservice in CDMA2000.