3
A brief file description
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
24
#include "ink_config.h"
26
//#include "tclExtend.h"
32
#include "I_Version.h"
33
#include "CliMgmtUtils.h"
34
#include "INKMgmtAPI.h"
36
extern int Tcl_AppInit(Tcl_Interp * interp);
37
extern int CliDisplayPrintf;
38
void eventCallbackFn(char *name, char *msg, int pri, void *data);
40
// default is that alarms appear in CLI as they occur
41
int AlarmCallbackPrint = 1;
43
// registers an event callback for all events in general
44
void register_event_callback(void);
46
AppVersionInfo appVersionInfo;
50
main(int argc, char *argv[])
54
// build the application information structure
55
appVersionInfo.setup(PACKAGE_NAME,"traffic_shell", PACKAGE_VERSION, __DATE__,
56
__TIME__, BUILD_MACHINE, BUILD_PERSON, "");
58
// Before accessing file system initialize Layout engine
61
// Argument description table used to describe how to parse command line args,
62
// see 'ink_args.h' for meanings of the various fields
63
ArgumentDescription argument_descriptions[] = {
64
{"version", 'V', "Print Version Id", "T", &version_flag, NULL, NULL}
67
int n_argument_descriptions = SIZE(argument_descriptions);
70
// Process command line arguments and dump into variables
71
process_args(argument_descriptions, n_argument_descriptions, argv);
73
// check for the version number request
75
ink_fputln(stderr, appVersionInfo.FullVersionInfoStr);
79
// traffic_shell binary should use printf to display information onscreen
82
// initialize MgmtAPI using TS runtime directory
83
status = INKInit(Layout::get()->runtimedir);
85
printf("INKInit %d: Failed to initialize MgmtAPI in %s\n",
86
status, Layout::get()->runtimedir);
88
printf("Successfully Initialized MgmtAPI in %s \n",
89
Layout::get()->runtimedir);
92
register_event_callback();
94
Tcl_Main(argc, argv, Tcl_AppInit);
99
eventCallbackFn(char *name, char *msg, int pri, void *data)
104
if (AlarmCallbackPrint == 1) {
105
printf("\n**********\n" "ALARM SIGNALLED: %s\n" "**********\n", name);
111
// registers an event callback for all events in general
113
register_event_callback(void)
115
// TODO: Check return code?
116
INKEventSignalCbRegister(NULL, eventCallbackFn, NULL);