2
* Drizzle Client & Protocol Library
4
* Copyright (C) 2008 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See
8
* the COPYING file in this directory for full text.
13
* @brief Local Connection Declarations
16
#ifndef __DRIZZLE_CONN_LOCAL_H
17
#define __DRIZZLE_CONN_LOCAL_H
24
* @addtogroup drizzle_con_local Local Connection Declarations
25
* @ingroup drizzle_con
30
* Clear address info, freeing structs if needed.
32
* @param[in] con Connection structure previously initialized with
33
* drizzle_con_create(), drizzle_con_clone(), or related functions.
36
void drizzle_con_reset_addrinfo(drizzle_con_st *con);
39
* Check if state stack is empty.
41
* @param[in] con Connection structure previously initialized with
42
* drizzle_con_create(), drizzle_con_clone(), or related functions.
43
* @return True if empty, false if something is on the stack.
45
static inline bool drizzle_state_none(drizzle_con_st *con)
47
return con->state_current == 0;
51
* Push a function onto the stack.
53
* @param[in] con Connection structure previously initialized with
54
* drizzle_con_create(), drizzle_con_clone(), or related functions.
55
* @param[in] function Function to push.
57
static inline void drizzle_state_push(drizzle_con_st *con,
58
drizzle_state_fn *function)
60
/* The maximum stack depth can be determined at compile time, so bump this
61
constant if needed to avoid the dynamic memory management. */
62
assert(con->state_current < DRIZZLE_STATE_STACK_SIZE);
63
con->state_stack[con->state_current]= function;
68
* Pop a function off of the stack.
70
* @param[in] con Connection structure previously initialized with
71
* drizzle_con_create(), drizzle_con_clone(), or related functions.
73
static inline void drizzle_state_pop(drizzle_con_st *con)
79
* Reset the stack so it is empty.
81
* @param[in] con Connection structure previously initialized with
82
* drizzle_con_create(), drizzle_con_clone(), or related functions.
84
static inline void drizzle_state_reset(drizzle_con_st *con)
86
con->state_current= 0;
95
#endif /* __DRIZZLE_CONN_LOCAL_H */