You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/01/21 01:36:53 UTC
svn commit: r1061587 [6/13] - in /trafficserver/traffic/trunk: ./ cop/
mgmt/api/ mgmt/api/include/ mgmt/api/remote/ mgmt/cli/ mgmt/tools/ mgmt/web2/
Modified: trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc?rev=1061587&r1=1061586&r2=1061587&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc Fri Jan 21 00:36:51 2011
@@ -47,7 +47,7 @@
* flushes the socket by reading the entire message out of the socket
* and then gets rid of the msg
**************************************************************************/
-INKError
+TSError
socket_flush(struct SocketInfo sock_info)
{
int ret, byte_read = 0;
@@ -55,7 +55,7 @@ socket_flush(struct SocketInfo sock_info
// check to see if anything to read; wait only for specified time
if (socket_read_timeout(sock_info.fd, MAX_TIME_WAIT, 0) <= 0) {
- return INK_ERR_NET_TIMEOUT;
+ return TS_ERR_NET_TIMEOUT;
}
// read entire message
while (byte_read < MAX_BUF_SIZE) {
@@ -67,21 +67,21 @@ socket_flush(struct SocketInfo sock_info
continue;
Debug("ts_main", "[socket_read_n] socket read for version byte failed.\n");
- mgmt_elog("[socket_flush] (INK_ERR_NET_READ) %s\n", strerror(errno));
- return INK_ERR_NET_READ;
+ mgmt_elog("[socket_flush] (TS_ERR_NET_READ) %s\n", strerror(errno));
+ return TS_ERR_NET_READ;
}
if (ret == 0) {
Debug("ts_main", "[socket_read_n] returned 0 on reading: %s.\n", strerror(errno));
- mgmt_log("[socket_flush] (INK_ERR_NET_EOF) %s\n", strerror(errno));
- return INK_ERR_NET_EOF;
+ mgmt_log("[socket_flush] (TS_ERR_NET_EOF) %s\n", strerror(errno));
+ return TS_ERR_NET_EOF;
}
// we are all good here
byte_read += ret;
}
mgmt_elog("[socket_flush] uh oh! didn't finish flushing socket!\n");
- return INK_ERR_FAIL;
+ return TS_ERR_FAIL;
}
/**************************************************************************
@@ -92,14 +92,14 @@ socket_flush(struct SocketInfo sock_info
* output: number of bytes read
* note: socket_read is implemented in WebUtils.cc
*************************************************************************/
-INKError
+TSError
socket_read_n(struct SocketInfo sock_info, char *buf, int bytes)
{
int ret, byte_read = 0;
// check to see if anything to read; wait for specified time
if (socket_read_timeout(sock_info.fd, MAX_TIME_WAIT, 0) <= 0) {
- return INK_ERR_NET_TIMEOUT;
+ return TS_ERR_NET_TIMEOUT;
}
// read until we fulfill the number
while (byte_read < bytes) {
@@ -111,20 +111,20 @@ socket_read_n(struct SocketInfo sock_inf
continue;
Debug("ts_main", "[socket_read_n] socket read for version byte failed.\n");
- mgmt_elog("[socket_read_n] (INK_ERR_NET_READ) %s\n", strerror(errno));
- return INK_ERR_NET_READ;
+ mgmt_elog("[socket_read_n] (TS_ERR_NET_READ) %s\n", strerror(errno));
+ return TS_ERR_NET_READ;
}
if (ret == 0) {
Debug("ts_main", "[socket_read_n] returned 0 on reading: %s.\n", strerror(errno));
- mgmt_log("[socket_read_n] (INK_ERR_NET_EOF) %s\n", strerror(errno));
- return INK_ERR_NET_EOF;
+ mgmt_log("[socket_read_n] (TS_ERR_NET_EOF) %s\n", strerror(errno));
+ return TS_ERR_NET_EOF;
}
// we are all good here
byte_read += ret;
}
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
/**************************************************************************
@@ -132,17 +132,17 @@ socket_read_n(struct SocketInfo sock_inf
*
* purpose: guarantees writing of n bytes or return error
* input: socket info struct, buffer to write from & number of bytes to write
- * output: INK_ERR_xx (depends on num bytes written)
+ * output: TS_ERR_xx (depends on num bytes written)
* note: socket_read is implemented in WebUtils.cc
*************************************************************************/
-INKError
+TSError
socket_write_n(struct SocketInfo sock_info, const char *buf, int bytes)
{
int ret, byte_wrote = 0;
// makes sure the socket descriptor is writable
if (socket_write_timeout(sock_info.fd, MAX_TIME_WAIT, 0) <= 0) {
- return INK_ERR_NET_TIMEOUT;
+ return TS_ERR_NET_TIMEOUT;
}
// read until we fulfill the number
while (byte_wrote < bytes) {
@@ -154,18 +154,18 @@ socket_write_n(struct SocketInfo sock_in
if (errno == EAGAIN)
continue;
- return INK_ERR_NET_WRITE;
+ return TS_ERR_NET_WRITE;
}
if (ret == 0) {
mgmt_elog("[socket_write_n] %s\n", strerror(errno));
- return INK_ERR_NET_EOF;
+ return TS_ERR_NET_EOF;
}
// we are all good here
byte_wrote += ret;
}
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
@@ -177,20 +177,20 @@ socket_write_n(struct SocketInfo sock_in
* input: sock_info - socket msg is read from
* op_t - the operation type specified in the msg
* msg - the data from the network message (no OpType or msg_len)
- * output: INK_ERR_xx ( if INK_ERR_OKAY, then parameters set successfully)
+ * output: TS_ERR_xx ( if TS_ERR_OKAY, then parameters set successfully)
* notes: Since preprocess_msg already removes the OpType and msg_len, this part o
* the message is not dealt with by the other parsing functions
**********************************************************************/
-INKError
+TSError
preprocess_msg(struct SocketInfo sock_info, OpType * op_t, char **req)
{
- INKError ret;
+ TSError ret;
int req_len;
int16_t op;
// read operation type
ret = socket_read_n(sock_info, (char *) &op, SIZE_OP_T);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
Debug("ts_main", "[preprocess_msg] ERROR %d reading op type\n", ret);
goto Lerror;
}
@@ -203,7 +203,7 @@ preprocess_msg(struct SocketInfo sock_in
mgmt_elog("[preprocess_msg] ERROR: %d is invalid op type\n", op);
// need to flush the invalid message from the socket
- if ((ret = socket_flush(sock_info)) != INK_ERR_NET_EOF)
+ if ((ret = socket_flush(sock_info)) != TS_ERR_NET_EOF)
mgmt_log("[preprocess_msg] unsuccessful socket flushing\n");
else
mgmt_log("[preprocess_msg] successfully flushed the socket\n");
@@ -212,7 +212,7 @@ preprocess_msg(struct SocketInfo sock_in
}
// now read the request msg size
ret = socket_read_n(sock_info, (char *) &req_len, SIZE_LEN);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
mgmt_elog("[preprocess_msg] ERROR %d reading msg size\n", ret);
Debug("ts_main", "[preprocess_msg] ERROR %d reading msg size\n", ret);
goto Lerror;
@@ -229,12 +229,12 @@ preprocess_msg(struct SocketInfo sock_in
} else {
*req = (char *) xmalloc(sizeof(char) * (req_len + 1));
if (!(*req)) {
- ret = INK_ERR_SYS_CALL;
+ ret = TS_ERR_SYS_CALL;
goto Lerror;
}
ret = socket_read_n(sock_info, *req, req_len);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
xfree(*req);
goto Lerror;
}
@@ -243,7 +243,7 @@ preprocess_msg(struct SocketInfo sock_in
Debug("ts_main", "[preprocess_msg] request message = %s\n", *req);
}
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
Lerror:
return ret;
@@ -260,22 +260,22 @@ Lerror:
* purpose: parses a file read request from a remote API client
* input: req - data that needs to be parsed
* file - the file type sent in the request
- * output: INK_ERR_xx
- * notes: request format = <INKFileNameT>
+ * output: TS_ERR_xx
+ * notes: request format = <TSFileNameT>
**********************************************************************/
-INKError
-parse_file_read_request(char *req, INKFileNameT * file)
+TSError
+parse_file_read_request(char *req, TSFileNameT * file)
{
int16_t file_t;
if (!req || !file)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// get file type - copy first 2 bytes of request
memcpy(&file_t, req, SIZE_FILE_T);
- *file = (INKFileNameT) file_t;
+ *file = (TSFileNameT) file_t;
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
/**********************************************************************
@@ -287,22 +287,22 @@ parse_file_read_request(char *req, INKFi
* text - the text that needs to be written
* size - length of the text
* ver - version of the file that is to be written
- * output: INK_ERR_xx
- * notes: request format = <INKFileNameT> <version> <size> <text>
+ * output: TS_ERR_xx
+ * notes: request format = <TSFileNameT> <version> <size> <text>
**********************************************************************/
-INKError
-parse_file_write_request(char *req, INKFileNameT * file, int *ver, int *size, char **text)
+TSError
+parse_file_write_request(char *req, TSFileNameT * file, int *ver, int *size, char **text)
{
int16_t file_t, f_ver;
int32_t f_size;
// check input is non-NULL
if (!req || !file || !ver || !size || !text)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// get file type - copy first 2 bytes of request
memcpy(&file_t, req, SIZE_FILE_T);
- *file = (INKFileNameT) file_t;
+ *file = (TSFileNameT) file_t;
// get file version - copy next 2 bytes
memcpy(&f_ver, req + SIZE_FILE_T, SIZE_VER);
@@ -315,11 +315,11 @@ parse_file_write_request(char *req, INKF
// get file text
*text = (char *) xmalloc(sizeof(char) * (f_size + 1));
if (!(*text))
- return INK_ERR_SYS_CALL;
+ return TS_ERR_SYS_CALL;
memcpy(*text, req + SIZE_FILE_T + SIZE_VER + SIZE_LEN, f_size);
(*text)[f_size] = '\0'; // end buffer
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
/**********************************************************************
@@ -329,17 +329,17 @@ parse_file_write_request(char *req, INKF
* input: req - request info from requestor
* name - first arg
* val - second arg
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* notes: format= <name_len> <val_len> <name> <val>
**********************************************************************/
-INKError
+TSError
parse_request_name_value(char *req, char **name_1, char **val_1)
{
int32_t name_len, val_len;
char *name, *val;
if (!req || !name_1 || !val_1)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// get record name length
memcpy(&name_len, req, SIZE_LEN);
@@ -350,7 +350,7 @@ parse_request_name_value(char *req, char
// get record name
name = (char *) xmalloc(sizeof(char) * (name_len + 1));
if (!name)
- return INK_ERR_SYS_CALL;
+ return TS_ERR_SYS_CALL;
memcpy(name, req + SIZE_LEN + SIZE_LEN, name_len);
name[name_len] = '\0'; // end string
*name_1 = name;
@@ -358,12 +358,12 @@ parse_request_name_value(char *req, char
// get record value - can be a MgmtInt, MgmtCounter ...
val = (char *) xmalloc(sizeof(char) * (val_len + 1));
if (!val)
- return INK_ERR_SYS_CALL;
+ return TS_ERR_SYS_CALL;
memcpy(val, req + SIZE_LEN + SIZE_LEN + name_len, val_len);
val[val_len] = '\0'; // end string
*val_1 = val;
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
@@ -373,22 +373,22 @@ parse_request_name_value(char *req, char
* purpose: parses a diags request
* input: diag_msg - the diag msg to be outputted
* mode - indicates what type of diag message
- * output: INK_ERR_xx
- * notes: request format = <INKDiagsT> <diag_msg_len> <diag_msg>
+ * output: TS_ERR_xx
+ * notes: request format = <TSDiagsT> <diag_msg_len> <diag_msg>
**********************************************************************/
-INKError
-parse_diags_request(char *req, INKDiagsT * mode, char **diag_msg)
+TSError
+parse_diags_request(char *req, TSDiagsT * mode, char **diag_msg)
{
int16_t diag_t;
int32_t msg_len;
// check input is non-NULL
if (!req || !mode || !diag_msg)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// get diags type - copy first 2 bytes of request
memcpy(&diag_t, req, SIZE_DIAGS_T);
- *mode = (INKDiagsT) diag_t;
+ *mode = (TSDiagsT) diag_t;
// get msg size - copy next 4 bytes
memcpy(&msg_len, req + SIZE_DIAGS_T, SIZE_LEN);
@@ -396,11 +396,11 @@ parse_diags_request(char *req, INKDiagsT
// get msg
*diag_msg = (char *) xmalloc(sizeof(char) * (msg_len + 1));
if (!(*diag_msg))
- return INK_ERR_SYS_CALL;
+ return TS_ERR_SYS_CALL;
memcpy(*diag_msg, req + SIZE_DIAGS_T + SIZE_LEN, msg_len);
(*diag_msg)[msg_len] = '\0'; // end buffer
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
/**********************************************************************
@@ -409,27 +409,27 @@ parse_diags_request(char *req, INKDiagsT
* purpose: parses a request to set the proxy state
* input: diag_msg - the diag msg to be outputted
* mode - indicates what type of diag message
- * output: INK_ERR_xx
- * notes: request format = <INKProxyStateT> <INKCacheClearT>
+ * output: TS_ERR_xx
+ * notes: request format = <TSProxyStateT> <TSCacheClearT>
**********************************************************************/
-INKError
-parse_proxy_state_request(char *req, INKProxyStateT * state, INKCacheClearT * clear)
+TSError
+parse_proxy_state_request(char *req, TSProxyStateT * state, TSCacheClearT * clear)
{
int16_t state_t, cache_t;
// check input is non-NULL
if (!req || !state || !clear)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// get proxy on/off
memcpy(&state_t, req, SIZE_PROXY_T);
- *state = (INKProxyStateT) state_t;
+ *state = (TSProxyStateT) state_t;
// get cahce-clearing type
memcpy(&cache_t, req + SIZE_PROXY_T, SIZE_TS_ARG_T);
- *clear = (INKCacheClearT) cache_t;
+ *clear = (TSCacheClearT) cache_t;
- return INK_ERR_OKAY;
+ return TS_ERR_OKAY;
}
/**********************************************************************
@@ -442,18 +442,18 @@ parse_proxy_state_request(char *req, INK
/**********************************************************************
* send_reply
*
- * purpose: sends a simple INK_ERR_* reply to the request made
+ * purpose: sends a simple TS_ERR_* reply to the request made
* input: return value - could be extended to support more complex
- * error codes but for now use only INK_ERR_FAIL, INK_ERR_OKAY
+ * error codes but for now use only TS_ERR_FAIL, TS_ERR_OKAY
* int fd - socket fd to use.
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes: this function does not need to go through the internal structure
* so no cleaning up is done.
**********************************************************************/
-INKError
-send_reply(struct SocketInfo sock_info, INKError retval)
+TSError
+send_reply(struct SocketInfo sock_info, TSError retval)
{
- INKError ret;
+ TSError ret;
char msg[SIZE_ERR_T];
int16_t ret_val;
@@ -473,29 +473,29 @@ send_reply(struct SocketInfo sock_info,
* purpose: sends the reply in response to a request to get list of string
* tokens (delimited by REMOTE_DELIM_STR)
* input: sock_info -
- * retval - INKError return type for the CoreAPI call
+ * retval - TSError return type for the CoreAPI call
* list - string delimited list of string tokens
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes:
- * format: <INKError> <string_list_len> <delimited_string_list>
+ * format: <TSError> <string_list_len> <delimited_string_list>
**********************************************************************/
-INKError
-send_reply_list(struct SocketInfo sock_info, INKError retval, char *list)
+TSError
+send_reply_list(struct SocketInfo sock_info, TSError retval, char *list)
{
- INKError ret;
+ TSError ret;
int msg_pos = 0, total_len;
char *msg;
int16_t ret_val;
int32_t list_size; // to be safe, typecast
if (!list) {
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
}
total_len = SIZE_ERR_T + SIZE_LEN + strlen(list);
msg = (char *) xmalloc(sizeof(char) * total_len);
if (!msg)
- return INK_ERR_SYS_CALL; // ERROR - malloc failed
+ return TS_ERR_SYS_CALL; // ERROR - malloc failed
// write the return value
ret_val = (int16_t) retval;
@@ -527,28 +527,28 @@ send_reply_list(struct SocketInfo sock_i
* val - the value of the record requested
* val_size - num bytes the value occupies
* rec_type - the type of the record value requested
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes: this function does not need to go through the internal structure
* so no cleaning up is done.
- * format = <INKError> <rec_val_len> <rec_type> <rec_val>
+ * format = <TSError> <rec_val_len> <rec_type> <rec_val>
**********************************************************************/
-INKError
-send_record_get_reply(struct SocketInfo sock_info, INKError retval, void *val, int val_size, INKRecordT rec_type)
+TSError
+send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, int val_size, TSRecordT rec_type)
{
- INKError ret;
+ TSError ret;
int msg_pos = 0, total_len;
char *msg;
int16_t record_t, ret_val;
int32_t v_size; // to be safe, typecast
if (!val) {
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
}
total_len = SIZE_ERR_T + SIZE_LEN + SIZE_REC_T + val_size;
msg = (char *) xmalloc(sizeof(char) * total_len);
if (!msg)
- return INK_ERR_SYS_CALL; // ERROR - malloc failed
+ return TS_ERR_SYS_CALL; // ERROR - malloc failed
// write the return value
ret_val = (int16_t) retval;
@@ -580,15 +580,15 @@ send_record_get_reply(struct SocketInfo
*
* purpose: sends reply to the record_set request made
* input:
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes: this function does not need to go through the internal structure
* so no cleaning up is done.
* format =
**********************************************************************/
-INKError
-send_record_set_reply(struct SocketInfo sock_info, INKError retval, INKActionNeedT action_need)
+TSError
+send_record_set_reply(struct SocketInfo sock_info, TSError retval, TSActionNeedT action_need)
{
- INKError ret;
+ TSError ret;
int total_len;
char *msg;
int16_t action_t, ret_val;
@@ -596,7 +596,7 @@ send_record_set_reply(struct SocketInfo
total_len = SIZE_ERR_T + SIZE_ACTION_T;
msg = (char *) xmalloc(sizeof(char) * total_len);
if (!msg)
- return INK_ERR_SYS_CALL; // ERROR - malloc failed!
+ return TS_ERR_SYS_CALL; // ERROR - malloc failed!
// write the return value
ret_val = (int16_t) retval;
@@ -620,30 +620,30 @@ send_record_set_reply(struct SocketInfo
*
* purpose: sends the reply in response to a file read request
* input: return value - could be extended to support more complex
- * error codes but for now use only INK_ERR_FAIL, INK_ERR_OKAY
+ * error codes but for now use only TS_ERR_FAIL, TS_ERR_OKAY
* int fd - socket fd to use.
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes: this function does not need to go through the internal structure
* so no cleaning up is done.
- * reply format = <INKError> <file_ver> <file_size> <file_text>
+ * reply format = <TSError> <file_ver> <file_size> <file_text>
**********************************************************************/
-INKError
-send_file_read_reply(struct SocketInfo sock_info, INKError retval, int ver, int size, char *text)
+TSError
+send_file_read_reply(struct SocketInfo sock_info, TSError retval, int ver, int size, char *text)
{
- INKError ret;
+ TSError ret;
int msg_pos = 0, msg_len;
char *msg;
int16_t ret_val, f_ver;
int32_t f_size; // to be safe
if (!text)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
// allocate space for buffer
msg_len = SIZE_ERR_T + SIZE_VER + SIZE_LEN + size;
msg = (char *) xmalloc(sizeof(char) * msg_len);
if (!msg)
- return INK_ERR_SYS_CALL;
+ return TS_ERR_SYS_CALL;
// write the return value
ret_val = (int16_t) retval;
@@ -678,14 +678,14 @@ send_file_read_reply(struct SocketInfo s
* purpose: sends the reply in response to a request to get state of proxy
* input:
* int fd - socket fd to use.
- * output: INK_ERR_*
- * notes: this function DOES NOT HAVE IT"S OWN INKError TO SEND!!!!
- * reply format = <INKProxyStateT>
+ * output: TS_ERR_*
+ * notes: this function DOES NOT HAVE IT"S OWN TSError TO SEND!!!!
+ * reply format = <TSProxyStateT>
**********************************************************************/
-INKError
-send_proxy_state_get_reply(struct SocketInfo sock_info, INKProxyStateT state)
+TSError
+send_proxy_state_get_reply(struct SocketInfo sock_info, TSProxyStateT state)
{
- INKError ret;
+ TSError ret;
char msg[SIZE_PROXY_T];
int16_t state_t;
@@ -705,16 +705,16 @@ send_proxy_state_get_reply(struct Socket
*
* purpose: sends the reply in response to a request check if event is active
* input: sock_info -
- * retval - INKError return type for the EventIsActive core call
+ * retval - TSError return type for the EventIsActive core call
* active - is the requested event active or not?
- * output: INK_ERR_*
+ * output: TS_ERR_*
* notes:
- * format: <INKError> <bool>
+ * format: <TSError> <bool>
**********************************************************************/
-INKError
-send_event_active_reply(struct SocketInfo sock_info, INKError retval, bool active)
+TSError
+send_event_active_reply(struct SocketInfo sock_info, TSError retval, bool active)
{
- INKError ret;
+ TSError ret;
int total_len;
char *msg;
int16_t is_active, ret_val;
@@ -722,7 +722,7 @@ send_event_active_reply(struct SocketInf
total_len = SIZE_ERR_T + SIZE_BOOL;
msg = (char *) xmalloc(sizeof(char) * total_len);
if (!msg)
- return INK_ERR_SYS_CALL; // ERROR - malloc failed!
+ return TS_ERR_SYS_CALL; // ERROR - malloc failed!
// write the return value
ret_val = (int16_t) retval;
@@ -747,27 +747,27 @@ send_event_active_reply(struct SocketInf
* has occurred (this msg will be received by the event_poll_thread)
* input: fd - file descriptor to use for writing
* event - the event that was signalled on TM side
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: format: <OpType> <event_name_len> <event_name> <desc_len> <desc>
**********************************************************************/
-INKError
-send_event_notification(struct SocketInfo sock_info, INKEvent * event)
+TSError
+send_event_notification(struct SocketInfo sock_info, TSEvent * event)
{
- INKError ret;
+ TSError ret;
int total_len, name_len, desc_len;
char *msg;
int16_t op_t;
int32_t len;
if (!event || !event->name || !event->description)
- return INK_ERR_PARAMS;
+ return TS_ERR_PARAMS;
name_len = strlen(event->name);
desc_len = strlen(event->description);
total_len = SIZE_OP_T + (SIZE_LEN * 2) + name_len + desc_len;
msg = (char *) xmalloc(sizeof(char) * total_len);
if (!msg)
- return INK_ERR_SYS_CALL; // ERROR - malloc failed!
+ return TS_ERR_SYS_CALL; // ERROR - malloc failed!
// write the operation
op_t = (int16_t) EVENT_NOTIFY;
Modified: trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.h?rev=1061587&r1=1061586&r2=1061587&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.h (original)
+++ trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.h Fri Jan 21 00:36:51 2011
@@ -49,33 +49,33 @@
/*****************************************************************************
* general socket functions
*****************************************************************************/
-INKError socket_flush(struct SocketInfo sock_info);
-INKError socket_read_n(struct SocketInfo sock_info, char *buf, int bytes);
-INKError socket_write_n(struct SocketInfo sock_info, const char *buf, int bytes);
+TSError socket_flush(struct SocketInfo sock_info);
+TSError socket_read_n(struct SocketInfo sock_info, char *buf, int bytes);
+TSError socket_write_n(struct SocketInfo sock_info, const char *buf, int bytes);
/*****************************************************************************
* Unmarshalling/marshalling
*****************************************************************************/
-INKError preprocess_msg(struct SocketInfo sock_info, OpType * op_t, char **msg);
+TSError preprocess_msg(struct SocketInfo sock_info, OpType * op_t, char **msg);
-INKError parse_request_name_value(char *req, char **name, char **val);
-INKError parse_record_get_request(char *req, char **rec_name);
-INKError parse_file_read_request(char *req, INKFileNameT * file);
-INKError parse_file_write_request(char *req, INKFileNameT * file, int *ver, int *size, char **text);
-INKError parse_diags_request(char *req, INKDiagsT * mode, char **diag_msg);
-INKError parse_proxy_state_request(char *req, INKProxyStateT * state, INKCacheClearT * clear);
-
-INKError send_reply(struct SocketInfo sock_info, INKError retval);
-INKError send_reply_list(struct SocketInfo sock_info, INKError retval, char *list);
-
-INKError send_record_get_reply(struct SocketInfo sock_info, INKError retval, void *val, int val_size,
- INKRecordT rec_type);
-INKError send_record_set_reply(struct SocketInfo sock_info, INKError retval, INKActionNeedT action_need);
-INKError send_file_read_reply(struct SocketInfo sock_info, INKError retval, int ver, int size, char *text);
-INKError send_proxy_state_get_reply(struct SocketInfo sock_info, INKProxyStateT state);
+TSError parse_request_name_value(char *req, char **name, char **val);
+TSError parse_record_get_request(char *req, char **rec_name);
+TSError parse_file_read_request(char *req, TSFileNameT * file);
+TSError parse_file_write_request(char *req, TSFileNameT * file, int *ver, int *size, char **text);
+TSError parse_diags_request(char *req, TSDiagsT * mode, char **diag_msg);
+TSError parse_proxy_state_request(char *req, TSProxyStateT * state, TSCacheClearT * clear);
+
+TSError send_reply(struct SocketInfo sock_info, TSError retval);
+TSError send_reply_list(struct SocketInfo sock_info, TSError retval, char *list);
+
+TSError send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, int val_size,
+ TSRecordT rec_type);
+TSError send_record_set_reply(struct SocketInfo sock_info, TSError retval, TSActionNeedT action_need);
+TSError send_file_read_reply(struct SocketInfo sock_info, TSError retval, int ver, int size, char *text);
+TSError send_proxy_state_get_reply(struct SocketInfo sock_info, TSProxyStateT state);
-INKError send_event_active_reply(struct SocketInfo sock_info, INKError retval, bool active);
+TSError send_event_active_reply(struct SocketInfo sock_info, TSError retval, bool active);
-INKError send_event_notification(struct SocketInfo sock_info, INKEvent * event);
+TSError send_event_notification(struct SocketInfo sock_info, TSEvent * event);
#endif
Modified: trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc?rev=1061587&r1=1061586&r2=1061587&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc Fri Jan 21 00:36:51 2011
@@ -186,7 +186,7 @@ ts_ctrl_main(void *arg)
// create a new instance to store client connection info
ClientT *new_client_con = create_client();
if (!new_client_con) {
- // return INK_ERR_SYS_CALL; WHAT TO DO? just keep going
+ // return TS_ERR_SYS_CALL; WHAT TO DO? just keep going
Debug("ts_main", "[ts_ctrl_main] can't allocate new ClientT\n");
} else { // accept connection
new_con_fd = mgmt_accept(con_socket_fd, new_client_con->adr, &addr_len);
@@ -211,7 +211,7 @@ ts_ctrl_main(void *arg)
// clear the fields first
op_t = UNDEFINED_OP;
ret = preprocess_msg(client_entry->sock_info, (OpType *) & op_t, &req);
- if (ret == INK_ERR_NET_READ || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_READ || ret == TS_ERR_NET_EOF) {
// occurs when remote API client terminates connection
Debug("ts_main", "[ts_ctrl_main] ERROR: preprocess_msg - remove client %d \n",
client_entry->sock_info.fd);
@@ -227,7 +227,7 @@ ts_ctrl_main(void *arg)
ret = handle_record_get(client_entry->sock_info, req);
if (req)
xfree(req); // free memory for req
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_get\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -239,7 +239,7 @@ ts_ctrl_main(void *arg)
ret = handle_record_set(client_entry->sock_info, req);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_set\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -252,7 +252,7 @@ ts_ctrl_main(void *arg)
ret = handle_file_read(client_entry->sock_info, req);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_read\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -265,7 +265,7 @@ ts_ctrl_main(void *arg)
ret = handle_file_write(client_entry->sock_info, req);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_write\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -278,7 +278,7 @@ ts_ctrl_main(void *arg)
ret = handle_proxy_state_get(client_entry->sock_info);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_get\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -291,7 +291,7 @@ ts_ctrl_main(void *arg)
ret = handle_proxy_state_set(client_entry->sock_info, req);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_set\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -304,7 +304,7 @@ ts_ctrl_main(void *arg)
ret = handle_reconfigure(client_entry->sock_info);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_reconfigure\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -317,7 +317,7 @@ ts_ctrl_main(void *arg)
ret = handle_restart(client_entry->sock_info, req, false);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -329,7 +329,7 @@ ts_ctrl_main(void *arg)
ret = handle_restart(client_entry->sock_info, req, true);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart bounce\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -341,7 +341,7 @@ ts_ctrl_main(void *arg)
ret = handle_event_resolve(client_entry->sock_info, req);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_event_resolve\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -353,7 +353,7 @@ ts_ctrl_main(void *arg)
ret = handle_event_get_mlt(client_entry->sock_info);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:event_get_mlt\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -365,7 +365,7 @@ ts_ctrl_main(void *arg)
ret = handle_event_active(client_entry->sock_info, req);
if (req)
xfree(req); // free the request allocated by preprocess_msg
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:event_active\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -379,7 +379,7 @@ ts_ctrl_main(void *arg)
ret = handle_snapshot(client_entry->sock_info, req, op_t);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:handle_snapshot\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -391,7 +391,7 @@ ts_ctrl_main(void *arg)
ret = handle_snapshot_get_mlt(client_entry->sock_info);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR:snapshot_get_mlt\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -410,7 +410,7 @@ ts_ctrl_main(void *arg)
ret = handle_stats_reset(client_entry->sock_info, req);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR: stats_reset\n");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -422,7 +422,7 @@ ts_ctrl_main(void *arg)
ret = handle_encrypt_to_file(client_entry->sock_info, req);
if (req)
xfree(req);
- if (ret == INK_ERR_NET_WRITE || ret == INK_ERR_NET_EOF) {
+ if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
Debug("ts_main", "[ts_ctrl_main] ERROR: encrypt_to_file");
remove_client(client_entry, accepted_con);
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -477,8 +477,8 @@ ts_ctrl_main(void *arg)
* with only the error return value in the msg!!! It's important that if
* an error does occur, the "send_reply" function is used; otherwise the socket
* will get written with too much extraneous stuff; the remote side will
- * only read the INKError type since that's all it expects to be in the message
- * (for an INKError != INK_ERR_OKAY).
+ * only read the TSError type since that's all it expects to be in the message
+ * (for an TSError != TS_ERR_OKAY).
*/
/**************************************************************************
@@ -491,50 +491,50 @@ ts_ctrl_main(void *arg)
* output: SUCC or ERR
* note:
*************************************************************************/
-INKError
+TSError
handle_record_get(struct SocketInfo sock_info, char *req)
{
- INKError ret;
- INKRecordEle *ele;
+ TSError ret;
+ TSRecordEle *ele;
// parse msg - don't really need since the request itself is the record name
if (!req) {
- ret = send_reply(sock_info, INK_ERR_FAIL);
+ ret = send_reply(sock_info, TS_ERR_FAIL);
return ret;
}
// call CoreAPI call on Traffic Manager side
- ele = INKRecordEleCreate();
+ ele = TSRecordEleCreate();
ret = MgmtRecordGet(req, ele);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
- INKRecordEleDestroy(ele);
+ TSRecordEleDestroy(ele);
return ret;
}
// create and send reply back to client
switch (ele->rec_type) {
- case INK_REC_INT:
- ret = send_record_get_reply(sock_info, ret, &(ele->int_val), sizeof(INKInt), ele->rec_type);
+ case TS_REC_INT:
+ ret = send_record_get_reply(sock_info, ret, &(ele->int_val), sizeof(TSInt), ele->rec_type);
break;
- case INK_REC_COUNTER:
- ret = send_record_get_reply(sock_info, ret, &(ele->counter_val), sizeof(INKCounter), ele->rec_type);
+ case TS_REC_COUNTER:
+ ret = send_record_get_reply(sock_info, ret, &(ele->counter_val), sizeof(TSCounter), ele->rec_type);
break;
- case INK_REC_FLOAT:
- ret = send_record_get_reply(sock_info, ret, &(ele->float_val), sizeof(INKFloat), ele->rec_type);
+ case TS_REC_FLOAT:
+ ret = send_record_get_reply(sock_info, ret, &(ele->float_val), sizeof(TSFloat), ele->rec_type);
break;
- case INK_REC_STRING:
+ case TS_REC_STRING:
ret = send_record_get_reply(sock_info, ret, ele->string_val, strlen(ele->string_val), ele->rec_type);
break;
default: // invalid record type
- ret = send_reply(sock_info, INK_ERR_FAIL);
- INKRecordEleDestroy(ele);
+ ret = send_reply(sock_info, TS_ERR_FAIL);
+ TSRecordEleDestroy(ele);
return ret;
}
- if (ret != INK_ERR_OKAY) { // error sending reply
+ if (ret != TS_ERR_OKAY) { // error sending reply
ret = send_reply(sock_info, ret);
}
- INKRecordEleDestroy(ele); // free any memory allocated by CoreAPI call
+ TSRecordEleDestroy(ele); // free any memory allocated by CoreAPI call
return ret;
}
@@ -548,20 +548,20 @@ handle_record_get(struct SocketInfo sock
* output: SUCC or ERR
* note: request format = <record name>DELIMITER<record_value>
*************************************************************************/
-INKError
+TSError
handle_record_set(struct SocketInfo sock_info, char *req)
{
char *name, *val;
- INKError ret;
- INKActionNeedT action = INK_ACTION_UNDEFINED;
+ TSError ret;
+ TSActionNeedT action = TS_ACTION_UNDEFINED;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret;
}
// parse request msg
ret = parse_request_name_value(req, &name, &val);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
if (name)
xfree(name);
@@ -574,7 +574,7 @@ handle_record_set(struct SocketInfo sock
if (val)
xfree(val);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
return ret;
}
@@ -592,33 +592,33 @@ handle_record_set(struct SocketInfo sock
* output: SUCC or ERR
* note: None
*************************************************************************/
-INKError
+TSError
handle_file_read(struct SocketInfo sock_info, char *req)
{
- INKError ret;
+ TSError ret;
int size, version;
- INKFileNameT file;
+ TSFileNameT file;
char *text;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret;
}
// first parse the message to retrieve needed data
ret = parse_file_read_request(req, &file);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
return ret;
}
// make CoreAPI call on Traffic Manager side
ret = ReadFile(file, &text, &size, &version);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
return ret;
}
// marshal the file info message that can be returned to client
ret = send_file_read_reply(sock_info, ret, version, size, text);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
}
@@ -636,21 +636,21 @@ handle_file_read(struct SocketInfo sock_
* output: SUCC or ERR
* note: None
*************************************************************************/
-INKError
+TSError
handle_file_write(struct SocketInfo sock_info, char *req)
{
- INKError ret;
+ TSError ret;
int size, version;
- INKFileNameT file;
+ TSFileNameT file;
char *text;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret;
}
// first parse the message
ret = parse_file_write_request(req, &file, &version, &size, &text);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
return ret;
}
@@ -670,14 +670,14 @@ handle_file_write(struct SocketInfo sock
*
* purpose: handles request to get the state of the proxy (TS)
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: None
*************************************************************************/
-INKError
+TSError
handle_proxy_state_get(struct SocketInfo sock_info)
{
- INKProxyStateT state;
- INKError ret;
+ TSProxyStateT state;
+ TSError ret;
// make coreAPI call on local side
state = ProxyStateGet();
@@ -695,23 +695,23 @@ handle_proxy_state_get(struct SocketInfo
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - indicates which state to set it to (on/off?) and specifies
* what to set the ts options too (optional)
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: None
*************************************************************************/
-INKError
+TSError
handle_proxy_state_set(struct SocketInfo sock_info, char *req)
{
- INKProxyStateT state;
- INKCacheClearT clear;
- INKError ret;
+ TSProxyStateT state;
+ TSCacheClearT clear;
+ TSError ret;
if (!req) {
- ret = INK_ERR_FAIL;
+ ret = TS_ERR_FAIL;
goto END;
}
// the req should specify the state and any cache clearing options
ret = parse_proxy_state_request(req, &state, &clear);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
goto END;
}
@@ -727,13 +727,13 @@ END:
*
* purpose: handles request to reread the config files
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: None
*************************************************************************/
-INKError
+TSError
handle_reconfigure(struct SocketInfo sock_info)
{
- INKError ret;
+ TSError ret;
// make local side coreAPI call
ret = Reconfigure();
@@ -749,17 +749,17 @@ handle_reconfigure(struct SocketInfo soc
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - indicates if restart should be cluster wide or not
* bounce - indicate if the restart is a traffic_server bounce only
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: None
*************************************************************************/
-INKError
+TSError
handle_restart(struct SocketInfo sock_info, char *req, bool bounce)
{
int16_t cluster;
- INKError ret;
+ TSError ret;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret; // shouldn't get here
}
// the req should be a boolean value - typecase it
@@ -780,17 +780,17 @@ handle_restart(struct SocketInfo sock_in
*
* purpose: handles request to resolve an event
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: the req should be the event name
*************************************************************************/
-INKError
+TSError
handle_event_resolve(struct SocketInfo sock_info, char *req)
{
- INKError ret;
+ TSError ret;
// parse msg - don't really need since the request itself is the record name
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret; // shouldn't get here
}
// call CoreAPI call on Traffic Manager side; req == event_name
@@ -805,13 +805,13 @@ handle_event_resolve(struct SocketInfo s
*
* purpose: handles request to get list of active events
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: the req should be the event name
*************************************************************************/
-INKError
+TSError
handle_event_get_mlt(struct SocketInfo sock_info)
{
- INKError ret;
+ TSError ret;
LLQ *event_list;
char buf[MAX_BUF_SIZE];
char *event_name;
@@ -821,7 +821,7 @@ handle_event_get_mlt(struct SocketInfo s
// call CoreAPI call on Traffic Manager side; req == event_name
ret = ActiveEventGetMlt(event_list);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
delete_queue(event_list);
return ret;
@@ -849,23 +849,23 @@ handle_event_get_mlt(struct SocketInfo s
*
* purpose: handles request to resolve an event
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: the req should be the event name
*************************************************************************/
-INKError
+TSError
handle_event_active(struct SocketInfo sock_info, char *req)
{
- INKError ret;
+ TSError ret;
bool active;
// parse msg - don't really need since the request itself is the record name
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret; // shouldn't get here
}
// call CoreAPI call on Traffic Manager side; req == event_name
ret = EventIsActive(req, &active);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
return ret; //shouldn't get here
}
@@ -883,15 +883,15 @@ handle_event_active(struct SocketInfo so
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - the snapshot name
* op - SNAPSHOT_TAKE, SNAPSHOT_REMOVE, or SNAPSHOT_RESTORE
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
*************************************************************************/
-INKError
+TSError
handle_snapshot(struct SocketInfo sock_info, char *req, OpType op)
{
- INKError ret;
+ TSError ret;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret;
}
// call CoreAPI call on Traffic Manager side; req == snap_name
@@ -906,7 +906,7 @@ handle_snapshot(struct SocketInfo sock_i
ret = SnapshotRemove(req);
break;
default:
- ret = INK_ERR_FAIL;
+ ret = TS_ERR_FAIL;
break;
}
@@ -919,13 +919,13 @@ handle_snapshot(struct SocketInfo sock_i
*
* purpose: handles request to get list of snapshots
* input: struct SocketInfo sock_info - the socket to use to talk to client
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
* note: the req should be the event name
*************************************************************************/
-INKError
+TSError
handle_snapshot_get_mlt(struct SocketInfo sock_info)
{
- INKError ret;
+ TSError ret;
LLQ *snap_list;
char buf[MAX_BUF_SIZE];
char *snap_name;
@@ -935,7 +935,7 @@ handle_snapshot_get_mlt(struct SocketInf
// call CoreAPI call on Traffic Manager side; req == event_name
ret = SnapshotGetMlt(snap_list);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
delete_queue(snap_list);
return ret;
@@ -965,15 +965,15 @@ handle_snapshot_get_mlt(struct SocketInf
* purpose: handles diags request
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - the diag message (already formatted with arguments)
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
*************************************************************************/
void
handle_diags(struct SocketInfo sock_info, char *req)
{
NOWARN_UNUSED(sock_info);
NOWARN_UNUSED(req);
- INKError ret;
- INKDiagsT mode;
+ TSError ret;
+ TSDiagsT mode;
char *diag_msg = NULL;
DiagsLevel level;
@@ -981,36 +981,36 @@ handle_diags(struct SocketInfo sock_info
goto Lerror;
ret = parse_diags_request(req, &mode, &diag_msg);
- if (ret != INK_ERR_OKAY)
+ if (ret != TS_ERR_OKAY)
goto Lerror;
switch (mode) {
- case INK_DIAG_DIAG:
+ case TS_DIAG_DIAG:
level = DL_Diag;
break;
- case INK_DIAG_DEBUG:
+ case TS_DIAG_DEBUG:
level = DL_Debug;
break;
- case INK_DIAG_STATUS:
+ case TS_DIAG_STATUS:
level = DL_Status;
break;
- case INK_DIAG_NOTE:
+ case TS_DIAG_NOTE:
level = DL_Note;
break;
- case INK_DIAG_WARNING:
+ case TS_DIAG_WARNING:
level = DL_Warning;
break;
- case INK_DIAG_ERROR:
+ case TS_DIAG_ERROR:
level = DL_Error;
break;
- case INK_DIAG_FATAL:
+ case TS_DIAG_FATAL:
level = DL_Fatal;
break;
- case INK_DIAG_ALERT:
+ case TS_DIAG_ALERT:
level = DL_Alert;
break;
- case INK_DIAG_EMERGENCY:
+ case TS_DIAG_EMERGENCY:
level = DL_Emergency;
break;
default:
@@ -1018,7 +1018,7 @@ handle_diags(struct SocketInfo sock_info
}
if (diags_init) {
- diags->print("INKMgmtAPI", level, NULL, NULL, diag_msg);
+ diags->print("TSMgmtAPI", level, NULL, NULL, diag_msg);
if (diag_msg)
xfree(diag_msg);
return;
@@ -1036,16 +1036,16 @@ Lerror:
* purpose: handles request to reset statistics to default values
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - should be NULL
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
*************************************************************************/
-INKError
+TSError
handle_stats_reset(struct SocketInfo sock_info, char *req)
{
int16_t cluster;
- INKError ret;
+ TSError ret;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret; // shouldn't get here
}
@@ -1065,21 +1065,21 @@ handle_stats_reset(struct SocketInfo soc
* purpose: handles request to encrypt password to file
* input: struct SocketInfo sock_info - the socket to use to talk to client
* req - should be NULL
- * output: INK_ERR_xx
+ * output: TS_ERR_xx
*************************************************************************/
-INKError
+TSError
handle_encrypt_to_file(struct SocketInfo sock_info, char *req)
{
char *pwd, *filepath;
- INKError ret;
+ TSError ret;
if (!req) {
- ret = send_reply(sock_info, INK_ERR_PARAMS);
+ ret = send_reply(sock_info, TS_ERR_PARAMS);
return ret;
}
// parse request msg
ret = parse_request_name_value(req, &pwd, &filepath);
- if (ret != INK_ERR_OKAY) {
+ if (ret != TS_ERR_OKAY) {
ret = send_reply(sock_info, ret);
if (pwd)
xfree(pwd);
Modified: trafficserver/traffic/trunk/mgmt/api/TSControlMain.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/TSControlMain.h?rev=1061587&r1=1061586&r2=1061587&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/TSControlMain.h (original)
+++ trafficserver/traffic/trunk/mgmt/api/TSControlMain.h Fri Jan 21 00:36:51 2011
@@ -48,29 +48,29 @@ void delete_client(ClientT * client);
void *ts_ctrl_main(void *arg);
-INKError handle_record_get(struct SocketInfo sock_info, char *req);
-INKError handle_record_set(struct SocketInfo sock_info, char *req);
+TSError handle_record_get(struct SocketInfo sock_info, char *req);
+TSError handle_record_set(struct SocketInfo sock_info, char *req);
-INKError handle_file_read(struct SocketInfo sock_info, char *req);
-INKError handle_file_write(struct SocketInfo sock_info, char *req);
+TSError handle_file_read(struct SocketInfo sock_info, char *req);
+TSError handle_file_write(struct SocketInfo sock_info, char *req);
-INKError handle_proxy_state_get(struct SocketInfo sock_info);
-INKError handle_proxy_state_set(struct SocketInfo sock_info, char *req);
-INKError handle_reconfigure(struct SocketInfo sock_info);
-INKError handle_restart(struct SocketInfo sock_info, char *req, bool bounce);
-
-INKError handle_event_resolve(struct SocketInfo sock_info, char *req);
-INKError handle_event_get_mlt(struct SocketInfo sock_info);
-INKError handle_event_active(struct SocketInfo sock_info, char *req);
+TSError handle_proxy_state_get(struct SocketInfo sock_info);
+TSError handle_proxy_state_set(struct SocketInfo sock_info, char *req);
+TSError handle_reconfigure(struct SocketInfo sock_info);
+TSError handle_restart(struct SocketInfo sock_info, char *req, bool bounce);
+
+TSError handle_event_resolve(struct SocketInfo sock_info, char *req);
+TSError handle_event_get_mlt(struct SocketInfo sock_info);
+TSError handle_event_active(struct SocketInfo sock_info, char *req);
-INKError handle_snapshot(struct SocketInfo sock_info, char *req, OpType op);
-INKError handle_snapshot_get_mlt(struct SocketInfo sock_info);
+TSError handle_snapshot(struct SocketInfo sock_info, char *req, OpType op);
+TSError handle_snapshot_get_mlt(struct SocketInfo sock_info);
void handle_diags(struct SocketInfo sock_info, char *req);
-INKError handle_stats_reset(struct SocketInfo sock_info, char *req);
+TSError handle_stats_reset(struct SocketInfo sock_info, char *req);
-INKError handle_encrypt_to_file(struct SocketInfo sock_info, char *req);
+TSError handle_encrypt_to_file(struct SocketInfo sock_info, char *req);
#endif