Class GSIBucketUtils


  • public class GSIBucketUtils
    extends java.lang.Object
    Utilities for deserializing, writing, and printing out GSI byte buckets.
    • Method Detail

      • deserialize

        public static GSIBucket deserialize​(XrootdSecurityProtocol.BucketType type,
                                            io.netty.buffer.ByteBuf buffer)
                                     throws java.io.IOException
        Deserialize an XrootdBucket. Depending on the BucketType, return an XrootdBucket of a specific subtype. The only type where the returned type is not a-priori known is kXRS_main, which can be encrypted. If it is encrypted, a binary (raw) bucket is returned, if it is not encyrpted, a list of contained buckets (nestedBuffer) is returned.
        Parameters:
        type - The type of the bucket that should be deserialized
        buffer - The buffer containing the buckets
        Returns:
        The deserialized bucket
        Throws:
        java.io.IOException
      • deserializeBuckets

        public static java.util.Map<XrootdSecurityProtocol.BucketType,​GSIBucket> deserializeBuckets​(io.netty.buffer.ByteBuf buffer)
                                                                                                   throws java.io.IOException
        Deserialize the buckets sent by the client and put them into a EnumMap sorted by their header-information. As there are list-type buffers, this method can be called recursively. In current xrootd, this is limited to a maximum of 1 recursion (main buffer containing list of further buffers).
        Parameters:
        buffer - The buffer containing the received buckets
        Returns:
        Map from bucket-type to deserialized buckets
        Throws:
        java.io.IOException - Failure of deserialization
      • deserializeNested

        public static NestedBucketBuffer deserializeNested​(XrootdSecurityProtocol.BucketType type,
                                                           io.netty.buffer.ByteBuf buffer)
                                                    throws java.io.IOException
        Deserialize the NestedBucketBuffer. Retrieve all the buckets and recursively deserialize them. Also, retrieve the protocol information and the step.
        Parameters:
        type - The type of the bucket (usually kXRS_main)
        buffer - The buffer containing the nested bucket buffer
        Returns:
        Deserialized buffer
        Throws:
        java.io.IOException - Deserialization fails
      • dumpBuckets

        public static void dumpBuckets​(java.lang.StringBuilder builder,
                                       java.util.Collection<GSIBucket> buckets,
                                       java.lang.String step)
      • dumpBytes

        public static void dumpBytes​(java.lang.StringBuilder builder,
                                     byte[] data)
      • getLengthForRequest

        public static int getLengthForRequest​(GSIBucketContainer container)