Merge lp:~alfonsosanchezbeato/nuntium/nuntium-preferred-context into lp:nuntium/packaging

Proposed by Alfonso Sanchez-Beato
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 95
Merged at revision: 95
Proposed branch: lp:~alfonsosanchezbeato/nuntium/nuntium-preferred-context
Merge into: lp:nuntium/packaging
Prerequisite: lp:~alfonsosanchezbeato/nuntium/upstart-respawn
Diff against target: 494 lines (+147/-42)
7 files modified
debian/changelog (+11/-0)
mms/attachments.go (+3/-3)
mms/decoder.go (+18/-2)
ofono/context_test.go (+60/-28)
ofono/manager.go (+9/-3)
ofono/modem.go (+16/-6)
ofono/push_decode_test.go (+30/-0)
To merge this branch: bzr merge lp:~alfonsosanchezbeato/nuntium/nuntium-preferred-context
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Review via email: mp+259607@code.launchpad.net

Commit message

  [ Sergio Schvezov ]
  * Decode properly content type when there are parameters
  [ Alfonso Sanchez-Beato ]
  * Fix LP: #1441135 in the event of an oFono crash
  * Use oFono's Preferred property when selecting the mobile context

Description of the change

  [ Sergio Schvezov ]
  * Decode properly content type when there are parameters
  [ Alfonso Sanchez-Beato ]
  * Fix LP: #1441135 in the event of an oFono crash
  * Use oFono's Preferred property when selecting the mobile context

To post a comment you must log in.
95. By Alfonso Sanchez-Beato

Fix package version

Revision history for this message
Manuel de la Peña (mandel) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-04-22 00:58:08 +0000
3+++ debian/changelog 2015-05-21 06:23:15 +0000
4@@ -1,3 +1,14 @@
5+nuntium (1.4+15.04.20150520-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ [ Sergio Schvezov ]
8+ * Decode properly content type when there are parameters
9+
10+ [ Alfonso Sanchez-Beato ]
11+ * Fix LP: #1441135 in the event of an oFono crash
12+ * Use oFono's Preferred property when selecting the mobile context
13+
14+ -- Alfonso Sanchez-Beato (email Canonical) <alfonso.sanchez-beato@canonical.com> Wed, 20 May 2015 14:19:54 +0200
15+
16 nuntium (1.4+15.04.20150422-0ubuntu1) vivid; urgency=medium
17
18 [ CI Train Bot ]
19
20=== modified file 'mms/attachments.go'
21--- mms/attachments.go 2014-09-23 19:58:36 +0000
22+++ mms/attachments.go 2015-05-21 06:23:15 +0000
23@@ -125,7 +125,7 @@
24 return dataParts
25 }
26
27-func (dec *MMSDecoder) ReadContentTypeParts(reflectedPdu *reflect.Value) error {
28+func (dec *MMSDecoder) ReadAttachmentParts(reflectedPdu *reflect.Value) error {
29 var err error
30 var parts uint64
31 if parts, err = dec.ReadUintVar(nil, ""); err != nil {
32@@ -147,7 +147,7 @@
33 var ct Attachment
34 ct.Offset = headerEnd + 1
35 ctReflected := reflect.ValueOf(&ct).Elem()
36- if err := dec.ReadContentType(&ctReflected); err == nil {
37+ if err := dec.ReadAttachment(&ctReflected); err == nil {
38 if err := dec.ReadMMSHeaders(&ctReflected, headerEnd); err != nil {
39 return err
40 }
41@@ -191,7 +191,7 @@
42 return nil
43 }
44
45-func (dec *MMSDecoder) ReadContentType(ctMember *reflect.Value) error {
46+func (dec *MMSDecoder) ReadAttachment(ctMember *reflect.Value) error {
47 if dec.Offset+1 >= len(dec.Data) {
48 return fmt.Errorf("message ended prematurely, offset: %d and payload length is %d", dec.Offset, len(dec.Data))
49 }
50
51=== modified file 'mms/decoder.go'
52--- mms/decoder.go 2015-01-15 15:45:48 +0000
53+++ mms/decoder.go 2015-05-21 06:23:15 +0000
54@@ -132,7 +132,17 @@
55
56 func (dec *MMSDecoder) ReadMediaType(reflectedPdu *reflect.Value, hdr string) (err error) {
57 var mediaType string
58+ var endOffset int
59 origOffset := dec.Offset
60+
61+ if dec.Data[dec.Offset+1] <= SHORT_LENGTH_MAX || dec.Data[dec.Offset+1] == LENGTH_QUOTE {
62+ if length, err := dec.ReadLength(nil); err != nil {
63+ return err
64+ } else {
65+ endOffset = int(length) + dec.Offset
66+ }
67+ }
68+
69 if dec.Data[dec.Offset+1] >= TEXT_MIN && dec.Data[dec.Offset+1] <= TEXT_MAX {
70 if mediaType, err = dec.ReadString(nil, ""); err != nil {
71 return err
72@@ -143,8 +153,14 @@
73 return fmt.Errorf("cannot decode media type for field beginning with %#x@%d", dec.Data[origOffset], origOffset)
74 }
75
76+ // skip the rest of the content type params
77+ if endOffset > 0 {
78+ dec.Offset = endOffset
79+ }
80+
81 reflectedPdu.FieldByName(hdr).SetString(mediaType)
82 dec.log = dec.log + fmt.Sprintf("%s: %s\n", hdr, mediaType)
83+
84 return nil
85 }
86
87@@ -371,12 +387,12 @@
88 _, err = dec.ReadString(&reflectedPdu, "TransactionId")
89 case CONTENT_TYPE:
90 ctMember := reflectedPdu.FieldByName("Content")
91- if err = dec.ReadContentType(&ctMember); err != nil {
92+ if err = dec.ReadAttachment(&ctMember); err != nil {
93 return err
94 }
95 //application/vnd.wap.multipart.related and others
96 if ctMember.FieldByName("MediaType").String() != "text/plain" {
97- err = dec.ReadContentTypeParts(&reflectedPdu)
98+ err = dec.ReadAttachmentParts(&reflectedPdu)
99 } else {
100 dec.Offset++
101 _, err = dec.ReadBoundedBytes(&reflectedPdu, "Data", len(dec.Data))
102
103=== modified file 'ofono/context_test.go'
104--- ofono/context_test.go 2014-09-30 18:01:12 +0000
105+++ ofono/context_test.go 2015-05-21 06:23:15 +0000
106@@ -38,11 +38,12 @@
107
108 var proxy ProxyInfo
109
110-func makeGenericContextProperty(name, cType string, active, messageCenter, messageProxy bool) PropertiesType {
111+func makeGenericContextProperty(name, cType string, active, messageCenter, messageProxy, preferred bool) PropertiesType {
112 p := make(PropertiesType)
113 p["Name"] = dbus.Variant{name}
114 p["Type"] = dbus.Variant{cType}
115 p["Active"] = dbus.Variant{active}
116+ p["Preferred"] = dbus.Variant{preferred}
117 if messageCenter {
118 p["MessageCenter"] = dbus.Variant{"http://messagecenter.com"}
119 } else {
120@@ -80,7 +81,7 @@
121 func (s *ContextTestSuite) TestMMSOverInternet(c *C) {
122 context1 := OfonoContext{
123 ObjectPath: "/ril_0/context1",
124- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true),
125+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true, false),
126 }
127 s.contexts = append(s.contexts, context1)
128
129@@ -93,7 +94,7 @@
130 func (s *ContextTestSuite) TestMMSOverInactiveInternet(c *C) {
131 context1 := OfonoContext{
132 ObjectPath: "/ril_0/context1",
133- Properties: makeGenericContextProperty("Context1", contextTypeInternet, false, true, true),
134+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, false, true, true, false),
135 }
136 s.contexts = append(s.contexts, context1)
137
138@@ -105,7 +106,7 @@
139 func (s *ContextTestSuite) TestMMSOverInternetNoProxy(c *C) {
140 context1 := OfonoContext{
141 ObjectPath: "/ril_0/context1",
142- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
143+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
144 }
145 s.contexts = append(s.contexts, context1)
146
147@@ -118,13 +119,13 @@
148 func (s *ContextTestSuite) TestMMSOverMMS(c *C) {
149 context1 := OfonoContext{
150 ObjectPath: "/ril_0/context1",
151- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, false, false),
152+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, false, false, false),
153 }
154 s.contexts = append(s.contexts, context1)
155
156 context2 := OfonoContext{
157 ObjectPath: "/ril_0/context2",
158- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, true),
159+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, true, false),
160 }
161 s.contexts = append(s.contexts, context2)
162
163@@ -137,13 +138,13 @@
164 func (s *ContextTestSuite) TestMMSOverMMSNoProxy(c *C) {
165 context1 := OfonoContext{
166 ObjectPath: "/ril_0/context1",
167- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, false, false),
168+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, false, false, false),
169 }
170 s.contexts = append(s.contexts, context1)
171
172 context2 := OfonoContext{
173 ObjectPath: "/ril_0/context2",
174- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
175+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
176 }
177 s.contexts = append(s.contexts, context2)
178
179@@ -156,13 +157,13 @@
180 func (s *ContextTestSuite) TestMMSMoreThanOneValid(c *C) {
181 context1 := OfonoContext{
182 ObjectPath: "/ril_0/context1",
183- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
184+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
185 }
186 s.contexts = append(s.contexts, context1)
187
188 context2 := OfonoContext{
189 ObjectPath: "/ril_0/context2",
190- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
191+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
192 }
193 s.contexts = append(s.contexts, context2)
194
195@@ -176,19 +177,19 @@
196 func (s *ContextTestSuite) TestMMSMoreThanOneValidContextSelectPreferred(c *C) {
197 context1 := OfonoContext{
198 ObjectPath: "/ril_0/context1",
199- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
200+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
201 }
202 s.contexts = append(s.contexts, context1)
203
204 context2 := OfonoContext{
205 ObjectPath: "/ril_0/context2",
206- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
207+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
208 }
209 s.contexts = append(s.contexts, context2)
210
211 context3 := OfonoContext{
212 ObjectPath: "/ril_0/context3",
213- Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false),
214+ Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false, false),
215 }
216 s.contexts = append(s.contexts, context3)
217
218@@ -203,19 +204,19 @@
219 func (s *ContextTestSuite) TestMMSMoreThanOneValidContextPreferredNoMatch(c *C) {
220 context1 := OfonoContext{
221 ObjectPath: "/ril_0/context1",
222- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
223+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
224 }
225 s.contexts = append(s.contexts, context1)
226
227 context2 := OfonoContext{
228 ObjectPath: "/ril_0/context2",
229- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
230+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
231 }
232 s.contexts = append(s.contexts, context2)
233
234 context3 := OfonoContext{
235 ObjectPath: "/ril_0/context3",
236- Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false),
237+ Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false, false),
238 }
239 s.contexts = append(s.contexts, context3)
240
241@@ -230,25 +231,25 @@
242 func (s *ContextTestSuite) TestMMSMoreThanOneValidContext2Active(c *C) {
243 context0 := OfonoContext{
244 ObjectPath: "/ril_0/context0",
245- Properties: makeGenericContextProperty("Context0", contextTypeInternet, false, true, false),
246+ Properties: makeGenericContextProperty("Context0", contextTypeInternet, false, true, false, false),
247 }
248 s.contexts = append(s.contexts, context0)
249
250 context1 := OfonoContext{
251 ObjectPath: "/ril_0/context1",
252- Properties: makeGenericContextProperty("Context1", contextTypeMMS, false, true, false),
253+ Properties: makeGenericContextProperty("Context1", contextTypeMMS, false, true, false, false),
254 }
255 s.contexts = append(s.contexts, context1)
256
257 context2 := OfonoContext{
258 ObjectPath: "/ril_0/context2",
259- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
260+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
261 }
262 s.contexts = append(s.contexts, context2)
263
264 context3 := OfonoContext{
265 ObjectPath: "/ril_0/context3",
266- Properties: makeGenericContextProperty("Context3", contextTypeMMS, true, true, false),
267+ Properties: makeGenericContextProperty("Context3", contextTypeMMS, true, true, false, false),
268 }
269 s.contexts = append(s.contexts, context3)
270
271@@ -263,25 +264,25 @@
272 func (s *ContextTestSuite) TestMMSMoreThanOneValidContextPreferredNotActive(c *C) {
273 context0 := OfonoContext{
274 ObjectPath: "/ril_0/context0",
275- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
276+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
277 }
278 s.contexts = append(s.contexts, context0)
279
280 context1 := OfonoContext{
281 ObjectPath: "/ril_0/context1",
282- Properties: makeGenericContextProperty("Context1", contextTypeMMS, false, true, false),
283+ Properties: makeGenericContextProperty("Context1", contextTypeMMS, false, true, false, false),
284 }
285 s.contexts = append(s.contexts, context1)
286
287 context2 := OfonoContext{
288 ObjectPath: "/ril_0/context2",
289- Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false),
290+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
291 }
292 s.contexts = append(s.contexts, context2)
293
294 context3 := OfonoContext{
295 ObjectPath: "/ril_0/context3",
296- Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false),
297+ Properties: makeGenericContextProperty("Context3", contextTypeMMS, false, true, false, false),
298 }
299
300 s.contexts = append(s.contexts, context3)
301@@ -295,10 +296,41 @@
302 c.Check(contexts[3], DeepEquals, context2)
303 }
304
305+func (s *ContextTestSuite) TestOnePreferredContext(c *C) {
306+ context0 := OfonoContext{
307+ ObjectPath: "/ril_0/context0",
308+ Properties: makeGenericContextProperty("Context0", contextTypeInternet, true, true, false, false),
309+ }
310+ s.contexts = append(s.contexts, context0)
311+
312+ context1 := OfonoContext{
313+ ObjectPath: "/ril_0/context1",
314+ Properties: makeGenericContextProperty("Context1", contextTypeMMS, false, true, false, true),
315+ }
316+ s.contexts = append(s.contexts, context1)
317+
318+ context2 := OfonoContext{
319+ ObjectPath: "/ril_0/context2",
320+ Properties: makeGenericContextProperty("Context2", contextTypeMMS, false, true, false, false),
321+ }
322+ s.contexts = append(s.contexts, context2)
323+
324+ context3 := OfonoContext{
325+ ObjectPath: "/ril_0/context3",
326+ Properties: makeGenericContextProperty("Context3", contextTypeMMS, true, true, false, false),
327+ }
328+ s.contexts = append(s.contexts, context3)
329+
330+ contexts, err := s.modem.GetMMSContexts("")
331+ c.Assert(err, IsNil)
332+ c.Assert(len(contexts), Equals, 1)
333+ c.Check(contexts[0], DeepEquals, context1)
334+}
335+
336 func (s *ContextTestSuite) TestGetProxy(c *C) {
337 context := OfonoContext{
338 ObjectPath: "/ril_0/context1",
339- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true),
340+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true, false),
341 }
342
343 p, err := context.GetProxy()
344@@ -309,7 +341,7 @@
345 func (s *ContextTestSuite) TestGetProxyNoProxy(c *C) {
346 context := OfonoContext{
347 ObjectPath: "/ril_0/context1",
348- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false),
349+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, false, false),
350 }
351
352 p, err := context.GetProxy()
353@@ -320,7 +352,7 @@
354 func (s *ContextTestSuite) TestGetProxyWithHTTP(c *C) {
355 context := OfonoContext{
356 ObjectPath: "/ril_0/context1",
357- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true),
358+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true, false),
359 }
360 context.Properties["MessageProxy"] = dbus.Variant{fmt.Sprintf("http://%s:%d", proxy.Host, proxy.Port)}
361
362@@ -332,7 +364,7 @@
363 func (s *ContextTestSuite) TestGetProxyNoPort(c *C) {
364 context := OfonoContext{
365 ObjectPath: "/ril_0/context1",
366- Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true),
367+ Properties: makeGenericContextProperty("Context1", contextTypeInternet, true, true, true, false),
368 }
369 context.Properties["MessageProxy"] = dbus.Variant{fmt.Sprintf("http://%s", proxy.Host)}
370
371
372=== modified file 'ofono/manager.go'
373--- ofono/manager.go 2014-05-08 23:23:22 +0000
374+++ ofono/manager.go 2015-05-21 06:23:15 +0000
375@@ -46,18 +46,24 @@
376 }
377
378 func (mm *ModemManager) Init() error {
379- modemAddedSignal, err := connectToSignal(mm.conn, "/", OFONO_MANAGER_INTERFACE, "ModemAdded")
380+ //Use a different connection for the modem signals to avoid go-dbus blocking issues
381+ conn, err := dbus.Connect(dbus.SystemBus)
382+ if err != nil {
383+ return err;
384+ }
385+
386+ modemAddedSignal, err := connectToSignal(conn, "/", OFONO_MANAGER_INTERFACE, "ModemAdded")
387 if err != nil {
388 return err
389 }
390- modemRemovedSignal, err := connectToSignal(mm.conn, "/", OFONO_MANAGER_INTERFACE, "ModemRemoved")
391+ modemRemovedSignal, err := connectToSignal(conn, "/", OFONO_MANAGER_INTERFACE, "ModemRemoved")
392 if err != nil {
393 return err
394 }
395 go mm.watchModems(modemAddedSignal, modemRemovedSignal)
396
397 //Check for existing modems
398- modemPaths, err := getModems(mm.conn)
399+ modemPaths, err := getModems(conn)
400 if err != nil {
401 log.Print("Cannot preemptively add modems: ", err)
402 } else {
403
404=== modified file 'ofono/modem.go'
405--- ofono/modem.go 2014-10-02 01:24:13 +0000
406+++ ofono/modem.go 2015-05-21 06:23:15 +0000
407@@ -310,6 +310,10 @@
408 return reflect.ValueOf(oContext.Properties["Active"].Value).Bool()
409 }
410
411+func (oContext OfonoContext) isPreferred() bool {
412+ return reflect.ValueOf(oContext.Properties["Preferred"].Value).Bool()
413+}
414+
415 func (oContext OfonoContext) hasMessageCenter() bool {
416 return oContext.messageCenter() != ""
417 }
418@@ -371,10 +375,11 @@
419 //and a MessageCenter within the context.
420 //
421 //The following rules take place:
422-//- check current type=internet context for MessageProxy & MessageCenter;
423-// if they exist and aren't empty AND the context is active, select it as the
424-// context to use for MMS.
425-//- otherwise search for type=mms, if found, use it and activate
426+//- if current type=internet context, check for MessageProxy & MessageCenter;
427+// if they exist and aren't empty AND the context is active, add it to the list
428+//- if current type=mms, add it to the list
429+//- if ofono's ConnectionManager.Preferred property is set, use only that context
430+//- prioritize active and recently successfully used contexts
431 //
432 //Returns either the type=internet context or the type=mms, if none is found
433 //an error is returned.
434@@ -386,7 +391,10 @@
435
436 for _, context := range contexts {
437 if (context.isTypeInternet() && context.isActive() && context.hasMessageCenter()) || context.isTypeMMS() {
438- if context.ObjectPath == preferredContext || context.isActive() {
439+ if context.isPreferred() {
440+ mmsContexts = []OfonoContext{context}
441+ break
442+ } else if context.ObjectPath == preferredContext || context.isActive() {
443 mmsContexts = append([]OfonoContext{context}, mmsContexts...)
444 } else {
445 mmsContexts = append(mmsContexts, context)
446@@ -418,7 +426,9 @@
447 }
448
449 func (modem *Modem) Delete() {
450- modem.IdentityRemoved <- modem.identity
451+ if modem.identity != "" {
452+ modem.IdentityRemoved <- modem.identity
453+ }
454 modem.modemSignal.Cancel()
455 modem.modemSignal.C = nil
456 modem.simSignal.Cancel()
457
458=== modified file 'ofono/push_decode_test.go'
459--- ofono/push_decode_test.go 2014-10-21 13:13:11 +0000
460+++ ofono/push_decode_test.go 2015-05-21 06:23:15 +0000
461@@ -169,3 +169,33 @@
462 dec := NewDecoder(inputBytes)
463 c.Assert(dec.Decode(s.pdu), DeepEquals, errors.New("7 != 6 is not a push PDU"))
464 }
465+
466+func (s *PushDecodeTestSuite) TestDecodeTMobileUSA(c *C) {
467+ inputBytes := []byte{
468+ 0xc0, 0x06, 0x28, 0x1f, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
469+ 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x77, 0x61, 0x70, 0x2e, 0x6d,
470+ 0x6d, 0x73, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00, 0x81, 0x84,
471+ 0x8d, 0x80, 0xaf, 0x84, 0x8c, 0x82, 0x98, 0x6d, 0x61, 0x76, 0x6f, 0x64, 0x69,
472+ 0x2d, 0x37, 0x2d, 0x38, 0x39, 0x2d, 0x31, 0x63, 0x30, 0x2d, 0x37, 0x2d, 0x63,
473+ 0x61, 0x2d, 0x35, 0x30, 0x66, 0x39, 0x33, 0x38, 0x34, 0x33, 0x2d, 0x37, 0x2d,
474+ 0x31, 0x33, 0x62, 0x2d, 0x32, 0x65, 0x62, 0x2d, 0x31, 0x2d, 0x63, 0x61, 0x2d,
475+ 0x33, 0x36, 0x31, 0x65, 0x33, 0x31, 0x35, 0x00, 0x8d, 0x92, 0x89, 0x1a, 0x80,
476+ 0x18, 0x83, 0x2b, 0x31, 0x39, 0x31, 0x39, 0x39, 0x30, 0x33, 0x33, 0x34, 0x38,
477+ 0x38, 0x2f, 0x54, 0x59, 0x50, 0x45, 0x3d, 0x50, 0x4c, 0x4d, 0x4e, 0x00, 0x8a,
478+ 0x80, 0x8e, 0x03, 0x0f, 0x21, 0x9f, 0x88, 0x05, 0x81, 0x03, 0x03, 0xf4, 0x80,
479+ 0x83, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x61, 0x74, 0x6c, 0x32, 0x6d,
480+ 0x6f, 0x73, 0x67, 0x65, 0x74, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x65, 0x6e, 0x67,
481+ 0x2e, 0x74, 0x2d, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
482+ 0x2f, 0x6d, 0x6d, 0x73, 0x2f, 0x77, 0x61, 0x70, 0x65, 0x6e, 0x63, 0x3f, 0x54,
483+ 0x3d, 0x6d, 0x61, 0x76, 0x6f, 0x64, 0x69, 0x2d, 0x37, 0x2d, 0x31, 0x33, 0x62,
484+ 0x2d, 0x32, 0x65, 0x62, 0x2d, 0x31, 0x2d, 0x63, 0x61, 0x2d, 0x33, 0x36, 0x31,
485+ 0x65, 0x33, 0x31, 0x35, 0x00,
486+ }
487+ dec := NewDecoder(inputBytes)
488+ c.Assert(dec.Decode(s.pdu), IsNil)
489+
490+ c.Check(int(s.pdu.HeaderLength), Equals, 40)
491+ c.Check(int(s.pdu.ApplicationId), Equals, mms.PUSH_APPLICATION_ID)
492+ c.Check(s.pdu.ContentType, Equals, mms.VND_WAP_MMS_MESSAGE)
493+ c.Check(len(s.pdu.Data), Equals, 183)
494+}

Subscribers

People subscribed via source and target branches