|
|
@@ -30,11 +30,21 @@ IndexMessage Structure:
|
|
|
\ Zero or more FileInfo Structures \
|
|
|
/ /
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Flags |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Number of Options |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+/ /
|
|
|
+\ Zero or more Option Structures \
|
|
|
+/ /
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
struct IndexMessage {
|
|
|
string Folder<64>;
|
|
|
FileInfo Files<>;
|
|
|
+ unsigned int Flags;
|
|
|
+ Option Options<64>;
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
@@ -75,6 +85,17 @@ func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
return xw.Tot(), err
|
|
|
}
|
|
|
}
|
|
|
+ xw.WriteUint32(o.Flags)
|
|
|
+ if l := len(o.Options); l > 64 {
|
|
|
+ return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
|
|
|
+ }
|
|
|
+ xw.WriteUint32(uint32(len(o.Options)))
|
|
|
+ for i := range o.Options {
|
|
|
+ _, err := o.Options[i].encodeXDR(xw)
|
|
|
+ if err != nil {
|
|
|
+ return xw.Tot(), err
|
|
|
+ }
|
|
|
+ }
|
|
|
return xw.Tot(), xw.Error()
|
|
|
}
|
|
|
|
|
|
@@ -96,6 +117,15 @@ func (o *IndexMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
for i := range o.Files {
|
|
|
(&o.Files[i]).decodeXDR(xr)
|
|
|
}
|
|
|
+ o.Flags = xr.ReadUint32()
|
|
|
+ _OptionsSize := int(xr.ReadUint32())
|
|
|
+ if _OptionsSize > 64 {
|
|
|
+ return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
+ }
|
|
|
+ o.Options = make([]Option, _OptionsSize)
|
|
|
+ for i := range o.Options {
|
|
|
+ (&o.Options[i]).decodeXDR(xr)
|
|
|
+ }
|
|
|
return xr.Error()
|
|
|
}
|
|
|
|
|
|
@@ -412,6 +442,20 @@ RequestMessage Structure:
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
| Size |
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Length of Hash |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+/ /
|
|
|
+\ Hash (variable length) \
|
|
|
+/ /
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Flags |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Number of Options |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+/ /
|
|
|
+\ Zero or more Option Structures \
|
|
|
+/ /
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
struct RequestMessage {
|
|
|
@@ -419,6 +463,9 @@ struct RequestMessage {
|
|
|
string Name<8192>;
|
|
|
unsigned hyper Offset;
|
|
|
unsigned int Size;
|
|
|
+ opaque Hash<64>;
|
|
|
+ unsigned int Flags;
|
|
|
+ Option Options<64>;
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
@@ -458,6 +505,21 @@ func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
xw.WriteString(o.Name)
|
|
|
xw.WriteUint64(o.Offset)
|
|
|
xw.WriteUint32(o.Size)
|
|
|
+ if l := len(o.Hash); l > 64 {
|
|
|
+ return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
|
|
|
+ }
|
|
|
+ xw.WriteBytes(o.Hash)
|
|
|
+ xw.WriteUint32(o.Flags)
|
|
|
+ if l := len(o.Options); l > 64 {
|
|
|
+ return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
|
|
|
+ }
|
|
|
+ xw.WriteUint32(uint32(len(o.Options)))
|
|
|
+ for i := range o.Options {
|
|
|
+ _, err := o.Options[i].encodeXDR(xw)
|
|
|
+ if err != nil {
|
|
|
+ return xw.Tot(), err
|
|
|
+ }
|
|
|
+ }
|
|
|
return xw.Tot(), xw.Error()
|
|
|
}
|
|
|
|
|
|
@@ -477,6 +539,16 @@ func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
o.Name = xr.ReadStringMax(8192)
|
|
|
o.Offset = xr.ReadUint64()
|
|
|
o.Size = xr.ReadUint32()
|
|
|
+ o.Hash = xr.ReadBytesMax(64)
|
|
|
+ o.Flags = xr.ReadUint32()
|
|
|
+ _OptionsSize := int(xr.ReadUint32())
|
|
|
+ if _OptionsSize > 64 {
|
|
|
+ return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
+ }
|
|
|
+ o.Options = make([]Option, _OptionsSize)
|
|
|
+ for i := range o.Options {
|
|
|
+ (&o.Options[i]).decodeXDR(xr)
|
|
|
+ }
|
|
|
return xr.Error()
|
|
|
}
|
|
|
|
|
|
@@ -493,10 +565,13 @@ ResponseMessage Structure:
|
|
|
\ Data (variable length) \
|
|
|
/ /
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Error |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
struct ResponseMessage {
|
|
|
opaque Data<>;
|
|
|
+ unsigned int Error;
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
@@ -527,6 +602,7 @@ func (o ResponseMessage) AppendXDR(bs []byte) ([]byte, error) {
|
|
|
|
|
|
func (o ResponseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
xw.WriteBytes(o.Data)
|
|
|
+ xw.WriteUint32(o.Error)
|
|
|
return xw.Tot(), xw.Error()
|
|
|
}
|
|
|
|
|
|
@@ -543,6 +619,7 @@ func (o *ResponseMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
|
|
func (o *ResponseMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
o.Data = xr.ReadBytes()
|
|
|
+ o.Error = xr.ReadUint32()
|
|
|
return xr.Error()
|
|
|
}
|
|
|
|
|
|
@@ -940,10 +1017,13 @@ CloseMessage Structure:
|
|
|
\ Reason (variable length) \
|
|
|
/ /
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
+| Code |
|
|
|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
struct CloseMessage {
|
|
|
string Reason<1024>;
|
|
|
+ unsigned int Code;
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
@@ -977,6 +1057,7 @@ func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Reason", l, 1024)
|
|
|
}
|
|
|
xw.WriteString(o.Reason)
|
|
|
+ xw.WriteUint32(o.Code)
|
|
|
return xw.Tot(), xw.Error()
|
|
|
}
|
|
|
|
|
|
@@ -993,6 +1074,7 @@ func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
|
|
func (o *CloseMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
o.Reason = xr.ReadStringMax(1024)
|
|
|
+ o.Code = xr.ReadUint32()
|
|
|
return xr.Error()
|
|
|
}
|
|
|
|