kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
kinetic_types.c
Go to the documentation of this file.
1 /*
2 * kinetic-c
3 * Copyright (C) 2015 Seagate Technology.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20 
21 #include "kinetic_types_internal.h"
22 #include "kinetic_types.h"
23 
24 STATIC const char* KineticStatusInvalid = "INVALID_STATUS_CODE";
26  "NOT_ATTEMPTED",
27  "SUCCESS",
28  "SESSION_EMPTY",
29  "SESSION_INVALID",
30  "HOST_EMPTY",
31  "HMAC_REQUIRED",
32  "NO_PDUS_AVAVILABLE",
33  "DEVICE_BUSY",
34  "CONNECTION_ERROR",
35  "INVALID_REQUEST",
36  "OPERATION_INVALID",
37  "OPERATION_FAILED",
38  "OPERATION_TIMEDOUT",
39  "CLUSTER_MISMATCH",
40  "VERSION_MISMATCH",
41  "DATA_ERROR",
42  "NOT_FOUND",
43  "BUFFER_OVERRUN",
44  "MEMORY_ERROR",
45  "SOCKET_TIMEOUT",
46  "SOCKET_ERROR",
47  "MISSING_KEY",
48  "MISSING_VALUE_BUFFER",
49  "MISSING_PIN",
50  "SSL_REQUIRED",
51  "DEVICE_LOCKED",
52  "ACL_ERROR",
53  "NOT_AUTHORIZED",
54  "INVALID_FILE",
55  "REQUEST_REJECTED",
56  "DEVICE_NAME_REQUIRED",
57  "INVALID_LOG_TYPE",
58  "HMAC_FAILURE",
59  "SESSION_TERMINATED",
60 };
61 
62 #ifdef TEST
63 STATIC const int KineticStatusDescriptorCount =
64  sizeof(KineticStatusDescriptor) / sizeof(char*);
65 #endif
66 
68 {
69  if ((int)status < 0 || status >= (int)KINETIC_STATUS_COUNT) {
70  return KineticStatusInvalid;
71  }
72  return KineticStatusDescriptor[(int)status];
73 }
74 
75 const char* KineticMessageTypeNames[33] =
76 {
77  "<UNKNOWN>"
78  "GET_RESPONSE",
79  "GET",
80  "PUT_RESPONSE",
81  "PUT",
82  "DELETE_RESPONSE",
83  "DELETE",
84  "GETNEXT_RESPONSE",
85  "GETNEXT",
86  "GETPREVIOUS_RESPONSE",
87  "GETPREVIOUS",
88  "GETKEYRANGE_RESPONSE",
89  "GETKEYRANGE",
90  "GETVERSION_RESPONSE",
91  "GETVERSION",
92  "SETUP_RESPONSE",
93  "SETUP",
94  "GETLOG_RESPONSE",
95  "GETLOG",
96  "SECURITY_RESPONSE",
97  "SECURITY",
98  "PEER2PEERPUSH_RESPONSE",
99  "PEER2PEERPUSH",
100  "NOOP_RESPONSE",
101  "NOOP",
102  "FLUSHALLDATA_RESPONSE",
103  "FLUSHALLDATA",
104  "PINOP_RESPONSE",
105  "PINOP",
106  "MEDIASCAN_RESPONSE",
107  "MEDIASCAN",
108  "MEDIAOPTIMIZE_RESPONSE",
109  "MEDIAOPTIMIZE"
110 };
111 
113 {
114  switch(type) {
147  return KineticMessageTypeNames[type];
148  default:
150  return KineticMessageTypeNames[0];
151  };
152 }
Number of status codes in KineticStatusDescriptor.
const char * KineticMessageTypeNames[33]
Definition: kinetic_types.c:75
#define STATIC
static const char * KineticStatusDescriptor[]
Definition: kinetic_types.c:25
const char * KineticMessageType_GetName(KineticMessageType type)
Provides a string representation for a Kinetic message type.
KineticStatus
Kinetic status codes.
KineticMessageType
Log info message types.
static const char * KineticStatusInvalid
Definition: kinetic_types.c:24
const char * Kinetic_GetStatusDescription(KineticStatus status)
Provides a string representation for a KineticStatus code.
Definition: kinetic_types.c:67