proto

package
v0.0.0-...-f427959 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2021 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const HandshakeLen = 32
View Source
const STREAM_TYPE = 0xffffffff

Variables

View Source
var Commands = map[string][2]uint32{
	"proto.Error":                {0, 0},
	"proto.Version":              {1, 1},
	"proto.Login":                {2, 3},
	"proto.LoginConfirmed":       {3, 0},
	"proto.Finished":             {4, 4},
	"proto.Success":              {5, 0},
	"proto.SetClientStoreMarker": {6, 0},

	"proto.GetObject":     {10, 5},
	"proto.MoveObject":    {11, 0},
	"proto.GetObjectName": {12, 13},
	"proto.ObjectName":    {13, 0},

	"proto.CreateDirectory":     {20, 0},
	"proto.ListDirectory":       {21, 5},
	"proto.ChangeDirAttributes": {22, 0},
	"proto.DeleteDirectory":     {23, 0},
	"proto.UndeleteDirectory":   {24, 0},

	"proto.StoreFile":                    {30, 5},
	"proto.GetFile":                      {31, 5},
	"proto.SetReplacementFileAttributes": {32, 0},
	"proto.DeleteFile":                   {33, 5},
	"proto.GetBlockIndexByID":            {34, 5},
	"proto.GetBlockIndexByName":          {35, 5},
	"proto.UndeleteFile":                 {36, 0},

	"proto.GetAccountUsage":  {40, 41},
	"proto.AccountUsage":     {41, 0},
	"proto.GetIsAlive":       {42, 0},
	"proto.IsAlive":          {43, 0},
	"proto.GetAccountUsage2": {44, 45},
	"proto.AccountUsage2":    {45, 0},

	"proto.CreateDirectory2": {46, 0},
}

This map contains commands with their responses.

View Source
var Handshake = "Box-Backup:v=C"

Functions

func GetCommand

func GetCommand(id uint32) (interface{}, bool)

Types

type AccountUsage

type AccountUsage struct {
	BlocksUsed           int64
	BlocksInOldFiles     int64
	BlocksInDeletedFiles int64
	BlocksInDirectories  int64
	BlocksSoftLimit      int64
	BlocksHardLimit      int64
	BlockSize            int32
}

type AccountUsage2

type AccountUsage2 struct {
	//String	AccountName
	Padding              uint32 // maybe number of accounts?
	AccountEnabled       bool
	ClientStoreMarker    int64
	BlockSize            int32
	LastObjectIDUsed     int64
	BlocksUsed           int64
	BlocksInCurrentFiles int64
	BlocksInOldFiles     int64
	BlocksInDeletedFiles int64
	BlocksInDirectories  int64
	BlocksSoftLimit      int64
	BlocksHardLimit      int64
	NumCurrentFiles      int64
	NumOldFiles          int64
	NumDeletedFiles      int64
	NumDirectories       int64
}

type AttributeStream

type AttributeStream struct {
	AttributeType        int32
	UID                  uint32
	GID                  uint32
	ModificationTime     uint64
	AttrModificationTime uint64
	UserDefinedFlags     uint32
	FileGenerationNumber uint32
	Mode                 uint16
}

BackupClientFileAttributes

type ChangeDirAttributes

type ChangeDirAttributes struct {
	ObjectID          int64
	AttributesModTime int64
}

type CreateDirectory

type CreateDirectory struct {
	ContainingDirectoryID int64
	AttributesModTime     int64
}

------------------------------------------------------------------------------------- # Directory commands # -----------------------------------------------------------------------------------

type CreateDirectory2

type CreateDirectory2 struct {
	ContainingDirectoryID int64
	AttributesModTime     int64
	ModificationTime      int64
}

type DeleteDirectory

type DeleteDirectory struct {
	ObjectID int64
}

type DeleteFile

type DeleteFile struct {
	InDirectory int64
}

type DirStream

type DirStream struct {
	MagicValue        int32 // also the version number
	NumEntries        int32
	ObjectID          int64 // this object ID
	ContainerID       int64 // ID of container
	AttributesModTime uint64
	OptionsPresent    int32 // bit mask of optional sections / features present

}

type EntryStream

type EntryStream struct {
	ModificationTime uint64
	ObjectID         int64
	SizeInBlocks     int64
	AttributesHash   uint64
	Flags            int16 // order smaller items after bigger ones (for alignment)

}

type Error

type Error struct {
	Type    int32 // 1000 = error
	SubType int32
}

type FileBlockIndex

type FileBlockIndex struct {
	// #define OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1 0x62696478
	MagicValue  int32   // different magic value
	OtherFileID int64   // the file ID of the 'other' file which may be referenced by the index
	EntryIVBase [8]byte // base value for block IV
	NumBlocks   int64   // repeat of value in file header
}

type FileBlockIndexEntry

type FileBlockIndexEntry struct {
	Size           int32    // size in clear
	WeakChecksum   uint32   // weak, rolling checksum
	StrongChecksum [16]byte //StrongChecksum[MD5Digest::DigestLength] uint8_t

}

FileBlockIndex is followed by the blocks, where each FileBlockIndexEntry is prefixed by the 8 byte header, which is either size or a block number in another file. typedef struct

{
        union
        {
                int64_t mEncodedSize;           // size encoded, if > 0
                int64_t mOtherBlockIndex;       // 0 - block number in other file, if <= 0
        };
        uint8_t mEnEnc[sizeof(file_BlockIndexEntryEnc)]; // Encoded section
} file_BlockIndexEntry;

type FileStreamFormat

type FileStreamFormat struct {
	// #define OBJECTMAGIC_FILE_MAGIC_VALUE_V1         0x66696C65
	// #define OBJECTMAGIC_DIR_MAGIC_VALUE             0x4449525F
	MagicValue        int32 // also the version number
	NumBlocks         int64 // number of blocks contained in the file
	ContainerID       int64
	ModificationTime  int64
	MaxBlockClearSize int32 // Maximum clear size that can be expected for a block
	Options           int32 // bitmask of options used

}

The stream contains this header with a magic marker specifying whether this is a file or directory.

type Finished

type Finished struct {
}

type GetAccountUsage

type GetAccountUsage struct {
}

type GetAccountUsage2

type GetAccountUsage2 struct {
}

type GetBlockIndexByID

type GetBlockIndexByID struct {
	ObjectID int64
}

type GetBlockIndexByName

type GetBlockIndexByName struct {
	InDirectory int64
}

type GetFile

type GetFile struct {
	InDirectory int64
	ObjectID    int64
}

type GetIsAlive

type GetIsAlive struct {
}

type GetObject

type GetObject struct {
	ObjectID int64
}

GetObject

Returns the object (file or directory) in store format, e.g. with file data first, followed by block index appended at the end. This means that whole encrypted stream needs to be fetched before accessing the block index.

type GetObjectName

type GetObjectName struct {
	ObjectID              int64
	ContainingDirectoryID int64
}
type Header struct {
	Size    uint32
	Command uint32
}

type IsAlive

type IsAlive struct {
}

type ListDirectory

type ListDirectory struct {
	ObjectID        int64
	FlagsMustBeSet  int16
	FlagsNotToBeSet int16
	SendAttributes  bool
}

type Login

type Login struct {
	Client int32
	Flags  int32
}

type LoginConfirmed

type LoginConfirmed struct {
	ClientStoreMarker int64
	BlocksUsed        int64
	BlocksSoftLimit   int64
	BlocksHardLimit   int64
}

type MoveObject

type MoveObject struct {
	ObjectID          int64
	MoveFromDirectory int64
	MoveToDirectory   int64
	Flags             int32
}

type ObjectName

type ObjectName struct {
	NumNameElements  int32
	ModificationTime int64
	AttributesHash   int64
	Flags            int16
}

type SetClientStoreMarker

type SetClientStoreMarker struct {
	ClientStoreMarker int64
}

type SetReplacementFileAttributes

type SetReplacementFileAttributes struct {
	InDirectory    int64
	AttributesHash int64
}

type StoreFile

type StoreFile struct {
	DirectoryObjectID int64
	ModificationTime  int64
	AttributesHash    int64
	DiffFromFileID    int64 // 0 if the file is not a diff

}

type Success

type Success struct {
	ObjectID int64
}

type UndeleteDirectory

type UndeleteDirectory struct {
	ObjectID int64
}

type UndeleteFile

type UndeleteFile struct {
	InDirectory int64
	ObjectID    int64
}

type Version

type Version struct {
	Version int32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL