@@ -69,6 +69,15 @@ function define_map_section(def) {
6969 define_section ( descriptor , unwrap , wrap ) ;
7070}
7171
72+ function Section ( typecode , content ) {
73+ this . typecode = typecode ;
74+ this . content = content ;
75+ }
76+
77+ Section . prototype . described = function ( ) {
78+ return types . described ( types . wrap_ulong ( this . typecode ) , types . wrap ( this . content ) ) ;
79+ } ;
80+
7281define_composite_section ( { name :'header' ,
7382 code :0x70 ,
7483 fields :[
@@ -101,12 +110,31 @@ define_composite_section({name:'properties',
101110 } ) ;
102111define_map_section ( { name :'application_properties' , code :0x74 } ) ;
103112
104- define_section ( { numeric :0x77 , symbolic :'amqp:value:* ' } ,
105- function ( msg , section ) { msg . body = types . unwrap ( section ) ; } ,
106- function ( sections , msg ) { sections . push ( types . described ( types . wrap_ulong ( 0x77 ) , types . wrap ( msg . body ) ) ) ; } ) ;
113+ define_section ( { numeric :0x75 , symbolic :'amqp:data:binary ' } , function ( msg , section ) { msg . body = new Section ( 0x75 , types . unwrap ( section ) ) ; } ) ;
114+ define_section ( { numeric : 0x76 , symbolic : 'amqp:amqp-sequence:list' } , function ( msg , section ) { msg . body = new Section ( 0x76 , types . unwrap ( section ) ) ; } ) ;
115+ define_section ( { numeric : 0x77 , symbolic : 'amqp:value:*' } , function ( msg , section ) { msg . body = types . unwrap ( section ) ; } ) ;
107116
108117define_map_section ( { name :'footer' , code :0x78 } ) ;
109118
119+
120+ function wrap_body ( sections , msg ) {
121+ if ( msg . body && msg . body . constructor === Section ) {
122+ sections . push ( msg . body . described ( ) ) ;
123+ } else {
124+ sections . push ( types . described ( types . wrap_ulong ( 0x77 ) , types . wrap ( msg . body ) ) ) ;
125+ }
126+ }
127+
128+ wrappers . push ( wrap_body ) ;
129+
130+ message . data_section = function ( data ) {
131+ return new Section ( 0x75 , data ) ;
132+ } ;
133+
134+ message . sequence_section = function ( list ) {
135+ return new Section ( 0x76 , list ) ;
136+ } ;
137+
110138function reverse_lookup ( map ) {
111139 var reversed = { } ;
112140 for ( var key in map ) {
0 commit comments