24 #include <sys/param.h>
33 switch (protoStatus) {
114 return protoSyncMode;
136 return kineticSyncMode;
144 switch (kinteicAlgorithm) {
165 return protoAlgorithm;
175 switch (protoAlgorithm) {
196 return kineticAlgorithm;
200 ProtobufCBinaryData protoData)
203 .
data = protoData.data, .len = protoData.len
210 if (src.data == NULL || src.len == 0) {
228 bool bufferOverflow =
false;
230 if (key_value != NULL && entry != NULL) {
232 if (key_value->has_dbversion && key_value->dbversion.len > 0) {
235 LOG1(
" BUFFER_OVERRUN: dbVersion");
236 bufferOverflow =
true;
244 if (key_value->has_key && key_value->key.len > 0) {
247 LOG1(
" BUFFER_OVERRUN: key");
248 bufferOverflow =
true;
256 if (key_value->has_tag && key_value->tag.len > 0) {
259 LOG1(
" BUFFER_OVERRUN: tag");
260 bufferOverflow =
true;
267 if (key_value->has_algorithm) {
270 key_value->algorithm);
274 return !bufferOverflow;
279 bool bufferOverflow =
false;
280 LOGF2(
"Copying: keyRange=0x%0llX, keys=0x%0llX, max_keys=%lld", keyRange, keys->
buffers, keys->
count);
281 if (keyRange != NULL && keys->
count > 0 && keys != NULL) {
282 for (
size_t i = 0; i < MIN((
size_t)keys->
count, (
size_t)keyRange->n_keys); i++) {
285 LOGF2(
"WANRNING: Buffer overrun for keys[%zd]", i);
286 bufferOverflow =
true;
289 keys->
used = keyRange->n_keys;
291 return !bufferOverflow;
296 static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
302 pthread_mutex_lock(&strerror_lock);
303 strncat(buf, strerror(err_num), len - 1);
304 pthread_mutex_unlock(&strerror_lock);
310 return (
struct timeval) {
318 return tv.tv_sec == 0 && tv.tv_usec == 0;
323 struct timeval result = {
324 .tv_sec = a.tv_sec + b.tv_sec,
325 .tv_usec = a.tv_usec + b.tv_usec,
328 if (result.tv_usec >= 1000000) {
330 result.tv_usec -= 1000000;
350 return (a.tv_sec == b.tv_sec) ?
cmp_suseconds_t(a.tv_usec, b.tv_usec) : ((a.tv_sec > b.tv_sec) ? 1 : -1);
388 if (dest == src) {
return;}
419 *hdr = (Com__Seagate__Kinetic__Proto__Command__Header) {
421 .has_clusterversion =
true,
422 .clusterversion = session->config.clusterVersion,
423 .has_connectionid =
true,
424 .connectionid = session->connectionID,
425 .has_sequence =
true,
434 memset(request, 0,
sizeof(KineticRequest));
437 request->command = &request->message.command;
438 request->command->header = &request->message.header;
An HMAC validation error was detected.
Structure for handling generic arrays of bytes.
KineticSynchronization
Enumeration of synchronization types for an operation on a KineticEntry.
void ByteBuffer_Reset(ByteBuffer *buffer)
KineticStatus KineticProtoStatusCode_to_KineticStatus(Com__Seagate__Kinetic__Proto__Command__Status__StatusCode protoStatus)
ByteBuffer * ByteBuffer_Append(ByteBuffer *buffer, const void *data, size_t len)
Com__Seagate__Kinetic__Proto__Command__MessageType
Structure for an embedded ByteArray as a buffer.
void com__seagate__kinetic__proto__message__init(Com__Seagate__Kinetic__Proto__Message *message)
void com__seagate__kinetic__proto__command__range__init(Com__Seagate__Kinetic__Proto__Command__Range *message)
This request is made persistent before returning.
Com__Seagate__Kinetic__Proto__Command__PinOperation pinOp
ByteBuffer tag
Generated authentication hash per the specified algorithm
KineticMessageType Com__Seagate__Kinetic__Proto__Command__MessageType_to_KineticMessageType(Com__Seagate__Kinetic__Proto__Command__MessageType type)
Structure used to specify the configuration for a session.
void com__seagate__kinetic__proto__command__get_log__init(Com__Seagate__Kinetic__Proto__Command__GetLog *message)
Com__Seagate__Kinetic__Proto__Command__GetLog__Type KineticLogInfo_Type_to_Com__Seagate__Kinetic__Proto__Command__GetLog__Type(KineticLogInfo_Type type)
Com__Seagate__Kinetic__Proto__Command__Range keyRange
struct timeval Kinetic_TimevalZero(void)
All pending information that has not been written is pushed to the disk and the command that specifie...
Com__Seagate__Kinetic__Proto__Command__Algorithm
Com__Seagate__Kinetic__Proto__Command__Synchronization
void com__seagate__kinetic__proto__command__init(Com__Seagate__Kinetic__Proto__Command *message)
int Kinetic_TimevalCmp(struct timeval const a, struct timeval const b)
void com__seagate__kinetic__proto__command__security__init(Com__Seagate__Kinetic__Proto__Command__Security *message)
The operation failed because the device is securely locked. An UNLOCK must be issued to unlock for us...
Com__Seagate__Kinetic__Proto__Command__GetLog__Device getLogDevice
void com__seagate__kinetic__proto__message__pinauth__init(Com__Seagate__Kinetic__Proto__Message__PINauth *message)
The specified object version info for a PUT/GET do not match stored object.
void com__seagate__kinetic__proto__command__pin_operation__init(Com__Seagate__Kinetic__Proto__Command__PinOperation *message)
Com__Seagate__Kinetic__Proto__Command__Status status
#define KINETIC_SEQUENCE_NOT_YET_BOUND
Something about the request is invalid.
KineticAlgorithm algorithm
Algorithm used to generate the specified tag
void com__seagate__kinetic__proto__command__setup__init(Com__Seagate__Kinetic__Proto__Command__Setup *message)
bool Copy_Com__Seagate__Kinetic__Proto__Command__Range_to_ByteBufferArray(Com__Seagate__Kinetic__Proto__Command__Range *keyRange, ByteBufferArray *keys)
int Kinetic_GetErrnoDescription(int err_num, char *buf, size_t len)
KineticAlgorithm
Enumeration of encryption/checksum key algorithms.
Com__Seagate__Kinetic__Proto__Message message
void com__seagate__kinetic__proto__command__get_log__device__init(Com__Seagate__Kinetic__Proto__Command__GetLog__Device *message)
ByteArray ProtobufCBinaryData_to_ByteArray(ProtobufCBinaryData protoData)
Device busy (retry later)
KineticSynchronization KineticSynchronization_from_Com__Seagate__Kinetic__Proto__Command__Synchronization(Com__Seagate__Kinetic__Proto__Command__Synchronization sync_mode)
ByteArray array
ByteArray holding allocated array w/length = allocated size.
const ProtobufCMessageDescriptor com__seagate__kinetic__proto__command__header__descriptor
Com__Seagate__Kinetic__Proto__Command__GetLog__Type
uint8_t keyData[(4096)]
This is the identity's HMAC Key.
KineticLogInfo_Type
Log info type.
The requested object does not exist.
void KineticSessionConfig_Copy(KineticSessionConfig *dest, KineticSessionConfig *src)
void KineticRequest_Init(KineticRequest *request, KineticSession const *const session)
Com__Seagate__Kinetic__Proto__Command__Header header
#define KINETIC_ASSERT(cond)
Com__Seagate__Kinetic__Proto__Message__PINauth pinAuth
No connection/disconnected.
KineticAlgorithm KineticAlgorithm_from_Com__Seagate__Kinetic__Proto__Command__Algorithm(Com__Seagate__Kinetic__Proto__Command__Algorithm protoAlgorithm)
void com__seagate__kinetic__proto__message__hmacauth__init(Com__Seagate__Kinetic__Proto__Message__HMACauth *message)
Com__Seagate__Kinetic__Proto__Command__Algorithm Com__Seagate__Kinetic__Proto__Command__Algorithm_from_KineticAlgorithm(KineticAlgorithm kinteicAlgorithm)
They can be made persistent when the drive chooses, or when a subsequent FLUSH is sent to the drive...
void KineticMessage_Init(KineticMessage *const message)
Invalid synchronization value.
static void KineticMessage_HeaderInit(Com__Seagate__Kinetic__Proto__Command__Header *hdr, KineticSession const *const session)
Com__Seagate__Kinetic__Proto__Command__Body body
size_t len
Number of bytes in the data field.
void com__seagate__kinetic__proto__command__body__init(Com__Seagate__Kinetic__Proto__Command__Body *message)
bool Kinetic_TimevalIsZero(struct timeval const tv)
struct timeval Kinetic_TimevalAdd(struct timeval const a, struct timeval const b)
Com__Seagate__Kinetic__Proto__Command__Synchronization Com__Seagate__Kinetic__Proto__Command__Synchronization_from_KineticSynchronization(KineticSynchronization sync_mode)
Device reported an operation error.
void com__seagate__kinetic__proto__command__key_value__init(Com__Seagate__Kinetic__Proto__Command__KeyValue *message)
ByteBuffer key
Key associated with the object stored on disk.
Com__Seagate__Kinetic__Proto__Command__KeyValue keyValue
Com__Seagate__Kinetic__Proto__Command__Security security
uint8_t * data
Pointer to an allocated array of data bytes.
Com__Seagate__Kinetic__Proto__Command__GetLog getLog
Status not available (no reponse/status available)
Com__Seagate__Kinetic__Proto__Command__Setup setup
KineticStatus
Kinetic status codes.
Device reported data error, no space or HMAC failure.
KineticMessageType
Log info message types.
Com__Seagate__Kinetic__Proto__Command command
void com__seagate__kinetic__proto__command__header__init(Com__Seagate__Kinetic__Proto__Command__Header *message)
size_t bytesUsed
Reflects the number of bytes used from the array
ByteBuffer dbVersion
Current version of the entry (optional)
Com__Seagate__Kinetic__Proto__Message__HMACauth hmacAuth
Com__Seagate__Kinetic__Proto__Command__Status__StatusCode
bool Copy_ProtobufCBinaryData_to_ByteBuffer(ByteBuffer dest, ProtobufCBinaryData src)
static int cmp_suseconds_t(suseconds_t const a, suseconds_t const b)
void com__seagate__kinetic__proto__command__status__init(Com__Seagate__Kinetic__Proto__Command__Status *message)
Specified cluster version does not match device.
bool Copy_Com__Seagate__Kinetic__Proto__Command__KeyValue_to_KineticEntry(Com__Seagate__Kinetic__Proto__Command__KeyValue *key_value, KineticEntry *entry)
#define LOGF2(message,...)