|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Amf |
|
17 * @subpackage Value |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: AbstractMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * This is the default Implementation of Message, which provides |
|
25 * a convenient base for behavior and association of common endpoints |
|
26 * |
|
27 * @package Zend_Amf |
|
28 * @subpackage Value |
|
29 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
30 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
31 */ |
|
32 class Zend_Amf_Value_Messaging_AbstractMessage |
|
33 { |
|
34 /** |
|
35 * @var string Client identifier |
|
36 */ |
|
37 public $clientId; |
|
38 |
|
39 /** |
|
40 * @var string Destination |
|
41 */ |
|
42 public $destination; |
|
43 |
|
44 /** |
|
45 * @var string Message identifier |
|
46 */ |
|
47 public $messageId; |
|
48 |
|
49 /** |
|
50 * @var int Message timestamp |
|
51 */ |
|
52 public $timestamp; |
|
53 |
|
54 /** |
|
55 * @var int Message TTL |
|
56 */ |
|
57 public $timeToLive; |
|
58 |
|
59 /** |
|
60 * @var object Message headers |
|
61 */ |
|
62 public $headers; |
|
63 |
|
64 /** |
|
65 * @var string Message body |
|
66 */ |
|
67 public $body; |
|
68 |
|
69 /** |
|
70 * generate a unique id |
|
71 * |
|
72 * Format is: ########-####-####-####-############ |
|
73 * Where # is an uppercase letter or number |
|
74 * example: 6D9DC7EC-A273-83A9-ABE3-00005FD752D6 |
|
75 * |
|
76 * @return string |
|
77 */ |
|
78 public function generateId() |
|
79 { |
|
80 return sprintf( |
|
81 '%08X-%04X-%04X-%02X%02X-%012X', |
|
82 mt_rand(), |
|
83 mt_rand(0, 65535), |
|
84 bindec(substr_replace( |
|
85 sprintf('%016b', mt_rand(0, 65535)), '0100', 11, 4) |
|
86 ), |
|
87 bindec(substr_replace(sprintf('%08b', mt_rand(0, 255)), '01', 5, 2)), |
|
88 mt_rand(0, 255), |
|
89 mt_rand() |
|
90 ); |
|
91 } |
|
92 } |