yumapro  20.10-14
YumaPro SDK
agt_callhome.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 - 2021, YumaWorks, Inc., All Rights Reserved.
3  *
4  * Unless required by applicable law or agreed to in writing,
5  * software distributed under the License is distributed on an
6  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7  * KIND, either express or implied. See the License for the
8  * specific language governing permissions and limitations
9  * under the License.
10  */
11 #ifdef WITH_CALLHOME
12 #ifndef _H_agt_callhome
13 #define _H_agt_callhome
14 
15 /* FILE: agt_callhome
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 15-jan-17 abb Begun
37 */
38 
39 #include <xmlstring.h>
40 #include <unistd.h>
41 
42 #ifndef _H_agt
43 #include "agt.h"
44 #endif
45 
46 #ifndef _H_dlq
47 #include "dlq.h"
48 #endif
49 
50 #ifndef _H_status_enum
51 #include "status_enum.h"
52 #endif
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /********************************************************************
59 * *
60 * C O N S T A N T S *
61 * *
62 *********************************************************************/
63 
64 /********************************************************************
65 * *
66 * T Y P E S *
67 * *
68 *********************************************************************/
69 
83 typedef struct agt_callhome_cb_t_ {
85  dlq_hdr_t qhdr;
86 
88  const xmlChar *ch_sshd_path;
89 
91  const xmlChar *ch_subsys_path;
92 
94  xmlChar *ch_name;
95 
97  xmlChar *ch_client_addr;
98 
100  xmlChar *ch_sshd_config;
101 
104 
107 
109  uint16 ch_retry_max;
110 
113 
115  boolean ch_reconnect;
116 
118  boolean ch_enabled;
119 
121  boolean ch_connecting;
122 
124  boolean ch_connected;
125 
127  boolean ch_from_cli;
128 
131 
133  uint32 ch_timer_id;
134 
136  pid_t ch_pid;
138 
139 
140 /********************************************************************
141 * *
142 * F U N C T I O N S *
143 * *
144 *********************************************************************/
145 
146 
152 extern status_t
153  agt_callhome_init (void);
154 
155 
161 extern status_t
163 
164 
170 extern status_t
171  agt_callhome_init2 (void);
172 
173 
179 extern void
180  agt_callhome_cleanup (void);
181 
182 
189 extern boolean
190  agt_callhome_connecting (const xmlChar *addr);
191 
192 
205 extern status_t
206  agt_callhome_add_server_cli (const xmlChar *valstr,
207  agt_ch_proto_t ch_proto);
208 
209 
224 extern status_t
225  agt_callhome_add_server (const xmlChar *ch_name,
226  const xmlChar *ch_addr,
227  uint16 ch_port,
228  agt_ch_proto_t ch_proto,
229  boolean start_now);
230 
231 
232 
240 extern status_t
241  agt_callhome_remove_server (const xmlChar *ch_name);
242 
243 
249 extern status_t
251 
252 
257 #ifdef __cplusplus
258 } /* end extern 'C' */
259 #endif
260 
261 #endif /* _H_agt_callhome */
262 
263 #endif // WITH_CALLHOME
control block for each client for a callhome connection
Definition: agt_callhome.h:83
void agt_callhome_cleanup(void)
Cleanup the Callhome module.
Definition: agt_callhome.c:687
dlq provides general double-linked list and queue support:
status_t agt_callhome_add_server_cli(const xmlChar *valstr, agt_ch_proto_t ch_proto)
Add a CallHome server entry from the –callhome-server CLI parm.
Definition: agt_callhome.c:764
xmlChar * ch_client_addr
callhome client address
Definition: agt_callhome.h:97
status_t agt_callhome_init(void)
Initialize the Callhome module.
Definition: agt_callhome.c:563
status_t agt_callhome_init2(void)
Initialize the Callhome module (Init phase II)
Definition: agt_callhome.c:605
boolean ch_from_cli
callhome entry is from CLI config, F: from YANG
Definition: agt_callhome.h:127
boolean ch_connecting
callhome is connecting
Definition: agt_callhome.h:121
uint16 ch_retry_max
callhome retry max tries
Definition: agt_callhome.h:109
const xmlChar * ch_subsys_path
back-ptr to global subsystem path config
Definition: agt_callhome.h:91
uint16 ch_retry_interval
callhome retry interval
Definition: agt_callhome.h:106
uint16 ch_client_port
callhome client port
Definition: agt_callhome.h:103
status_t agt_callhome_remove_server(const xmlChar *ch_name)
Remove a CallHome server entry added from a YANG module at run-time.
Definition: agt_callhome.c:1027
boolean ch_enabled
begin state, callhome enabled flag
Definition: agt_callhome.h:118
uint16 ch_retry_count
retry connection count if reconnect in progress
Definition: agt_callhome.h:130
boolean ch_connected
callhome is connected
Definition: agt_callhome.h:124
boolean ch_reconnect
enable callhome reconnects
Definition: agt_callhome.h:115
xmlChar * ch_sshd_config
callhome sshd config
Definition: agt_callhome.h:100
pid_t ch_pid
callhome child process ID running SSHd server
Definition: agt_callhome.h:136
status_t
global error return code
Definition: status_enum.h:186
Multi-Protocol Network Management Server.
const xmlChar * ch_sshd_path
back-ptr to global sshd path config
Definition: agt_callhome.h:88
agt_ch_proto_t ch_proto
callhome protocol to use
Definition: agt_callhome.h:112
agt_ch_proto_t
server callhome protocol
Definition: agt.h:692
xmlChar * ch_name
callhome server name
Definition: agt_callhome.h:94
status_t agt_callhome_remove_all_servers(void)
Remove all CallHome server entries added from a YANG module at run-time.
Definition: agt_callhome.c:1067
status_t agt_callhome_init_postcli(void)
Initialize the Callhome module POST CLI parms.
Definition: agt_callhome.c:583
status_t agt_callhome_add_server(const xmlChar *ch_name, const xmlChar *ch_addr, uint16 ch_port, agt_ch_proto_t ch_proto, boolean start_now)
Add a CallHome server entry from a YANG module at run-time.
Definition: agt_callhome.c:920
uint32 ch_timer_id
timer ID used for reconnect interval
Definition: agt_callhome.h:133
global error status code enumerations
boolean agt_callhome_connecting(const xmlChar *addr)
Check if the source address is connecting in a callhome session.
Definition: agt_callhome.c:723