OpFlex Framework  1.3.0
ofpeerstatuslistener_c.h
Go to the documentation of this file.
1 /* -*- C -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 #include "ofcore_c.h"
14 
15 #ifndef OPFLEX_C_OFPEERSTATUSLISTENER_H
16 #define OPFLEX_C_OFPEERSTATUSLISTENER_H
17 
45 #define OF_PEERSTATUS_DISCONNECTED 0
46 
49 #define OF_PEERSTATUS_CONNECTING 1
50 
53 #define OF_PEERSTATUS_CONNECTED 2
54 
57 #define OF_PEERSTATUS_READY 3
58 
61 #define OF_PEERSTATUS_CLOSING 4
62 
65 #define OF_PEERSTATUS_ERROR -1
66 
78 #define OF_POOLHEALTH_DOWN 0
79 
82 #define OF_POOLHEALTH_DEGRADED 1
83 
86 #define OF_POOLHEALTH_HEALTHY 2
87 
90 #define OF_POOLHEALTH_ERROR -1
91 
100 
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104 
116  typedef void (*ofpeerstatus_peer_p)(void* user_data,
117  const char *peerhostname,
118  int port,
119  int status);
120 
130  typedef void (*ofpeerstatus_health_p)(void* user_data,
131  int health);
132 
146  ofstatus ofpeerstatuslistener_create(void* user_data,
147  ofpeerstatus_peer_p peer_callback,
148  ofpeerstatus_health_p health_callback,
149  /* out */ ofpeerstatuslistener_p *obj);
150 
160 
161 #ifdef __cplusplus
162 } /* extern "C" */
163 #endif
164 
169 #endif /* OPFLEX_C_OFPEERSTATUSLISTENER_H */
ofstatus ofpeerstatuslistener_destroy(ofpeerstatuslistener_p *obj)
Destroy the peer status listener object, and zero the pointer.
ofstatus ofpeerstatuslistener_create(void *user_data, ofpeerstatus_peer_p peer_callback, ofpeerstatus_health_p health_callback, ofpeerstatuslistener_p *obj)
Creates peer status listener object.
ofobj_p ofpeerstatuslistener_p
A pointer to peer status listener object.
Definition: offramework_c.h:59
void(* ofpeerstatus_peer_p)(void *user_data, const char *peerhostname, int port, int status)
A function pointer to receive peer status updates.
Definition: ofpeerstatuslistener_c.h:116
ofobj_p ofpeerstatuslistener_p
cpoolhealth
Definition: ofpeerstatuslistener_c.h:99
void * ofobj_p
Base type for all OpFlex object pointers.
Definition: ofcore_c.h:89
void(* ofpeerstatus_health_p)(void *user_data, int health)
A function pointer to recieve connection pool health status updates.
Definition: ofpeerstatuslistener_c.h:130
C wrapper core defininitions.
int ofstatus
An opflex status code.
Definition: ofcore_c.h:84