Permalink
Browse files

code cleanup

* Use POSIX compliant declaration in vector lib
* Use POSIX compliant declaration in timer lib
* some cosmetics
  • Loading branch information...
1 parent c61288f commit 4d439c661eb2d5f9c234201038936616a78a67e0 @acassen committed Aug 17, 2012
View
@@ -1,15 +1 @@
-* Insert LDAP, FTP, SSH, IMAP, POP, RADIUS checkers.
-* documentation:
- - hackers guide
-* code cleanup:
- - check_ssl.c audit the password_cb() call back func
- for buffer overflow.
- - check smtp.c to release allocated buffer when terminate
- thread is registered. Occur when sigint is receive when
- smtp alertes have not been able to finish the whole sending
- sequence.
-* more choice with parameters, less hardcoded values
-* functionality:
- - hooks in VRRP framework for external checktools.
- As state transition decision
- - a VTYSH to administrate keepalived on the fly
+Whatever you want !
View
@@ -81,7 +81,7 @@ tcp_socket_state(int fd, thread_t * thread, uint32_t addr_ip, uint16_t addr_port
int status;
socklen_t slen;
int ret = 0;
- TIMEVAL timer_min;
+ timeval_t timer_min;
/* Handle connection timeout */
if (thread->type == THREAD_WRITE_TIMEOUT) {
@@ -116,7 +116,7 @@ tcp_socket_state(int fd, thread_t * thread, uint32_t addr_ip, uint16_t addr_port
timer_min = timer_sub_now(thread->sands);
thread_add_write(thread->master, func, THREAD_ARG(thread)
- , thread->u.fd, TIMER_LONG(timer_min));
+ , thread->u.fd, timer_long(timer_min));
return connect_in_progress;
}
@@ -128,19 +128,19 @@ alloc_vsg(char *gname)
list_add(check_data->vs_group, new);
}
void
-alloc_vsg_entry(vector strvec)
+alloc_vsg_entry(vector_t *strvec)
{
virtual_server_group *vsg = LIST_TAIL_DATA(check_data->vs_group);
virtual_server_group_entry *new;
new = (virtual_server_group_entry *) MALLOC(sizeof (virtual_server_group_entry));
- if (!strcmp(VECTOR_SLOT(strvec, 0), "fwmark")) {
- new->vfwmark = atoi(VECTOR_SLOT(strvec, 1));
+ if (!strcmp(vector_slot(strvec, 0), "fwmark")) {
+ new->vfwmark = atoi(vector_slot(strvec, 1));
list_add(vsg->vfwmark, new);
} else {
- new->range = inet_stor(VECTOR_SLOT(strvec, 0));
- inet_stosockaddr(VECTOR_SLOT(strvec, 0), VECTOR_SLOT(strvec, 1), &new->addr);
+ new->range = inet_stor(vector_slot(strvec, 0));
+ inet_stosockaddr(vector_slot(strvec, 0), vector_slot(strvec, 1), &new->addr);
if (!new->range)
list_add(vsg->addr_ip, new);
else
@@ -104,10 +104,10 @@ alloc_http_get(char *proto)
}
void
-http_get_handler(vector strvec)
+http_get_handler(vector_t *strvec)
{
http_checker_t *http_get_chk;
- char *str = VECTOR_SLOT(strvec, 0);
+ char *str = vector_slot(strvec, 0);
/* queue new checker */
http_get_chk = alloc_http_get(str);
@@ -117,21 +117,21 @@ http_get_handler(vector strvec)
}
void
-connect_p_handler(vector strvec)
+connect_p_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
checker_set_dst_port(&http_get_chk->dst, htons(CHECKER_VALUE_INT(strvec)));
}
void
-bindto_handler(vector strvec)
+bindto_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
- inet_stosockaddr(VECTOR_SLOT(strvec, 1), 0, &http_get_chk->bindto);
+ inet_stosockaddr(vector_slot(strvec, 1), 0, &http_get_chk->bindto);
}
void
-connect_to_handler(vector strvec)
+connect_to_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
http_get_chk->connection_to = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
@@ -140,21 +140,21 @@ connect_to_handler(vector strvec)
}
void
-nb_get_retry_handler(vector strvec)
+nb_get_retry_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
http_get_chk->nb_get_retry = CHECKER_VALUE_INT(strvec);
}
void
-delay_before_retry_handler(vector strvec)
+delay_before_retry_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
http_get_chk->delay_before_retry = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
}
void
-url_handler(vector strvec)
+url_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
url_t *new;
@@ -166,7 +166,7 @@ url_handler(vector strvec)
}
void
-path_handler(vector strvec)
+path_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
url_t *url = LIST_TAIL_DATA(http_get_chk->url);
@@ -175,7 +175,7 @@ path_handler(vector strvec)
}
void
-digest_handler(vector strvec)
+digest_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
url_t *url = LIST_TAIL_DATA(http_get_chk->url);
@@ -184,7 +184,7 @@ digest_handler(vector strvec)
}
void
-status_code_handler(vector strvec)
+status_code_handler(vector_t *strvec)
{
http_checker_t *http_get_chk = CHECKER_GET();
url_t *url = LIST_TAIL_DATA(http_get_chk->url);
@@ -750,7 +750,7 @@ http_check_thread(thread_t * thread)
new_req = 0;
if (http_get_check->proto == PROTO_SSL) {
- timeout = TIMER_LONG(thread->sands)-TIMER_LONG(time_now);
+ timeout = timer_long(thread->sands) - timer_long(time_now);
if (thread->type != THREAD_WRITE_TIMEOUT &&
thread->type != THREAD_READ_TIMEOUT)
ret = ssl_connect(thread, new_req);
@@ -61,7 +61,7 @@ dump_misc_check(void *data)
}
void
-misc_check_handler(vector strvec)
+misc_check_handler(vector_t *strvec)
{
misc_checker_t *misck_checker = (misc_checker_t *) MALLOC(sizeof (misc_checker_t));
@@ -71,21 +71,21 @@ misc_check_handler(vector strvec)
}
void
-misc_path_handler(vector strvec)
+misc_path_handler(vector_t *strvec)
{
misc_checker_t *misck_checker = CHECKER_GET();
misck_checker->path = CHECKER_VALUE_STRING(strvec);
}
void
-misc_timeout_handler(vector strvec)
+misc_timeout_handler(vector_t *strvec)
{
misc_checker_t *misck_checker = CHECKER_GET();
misck_checker->timeout = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
}
void
-misc_dynamic_handler(vector strvec)
+misc_dynamic_handler(vector_t *strvec)
{
misc_checker_t *misck_checker = CHECKER_GET();
misck_checker->dynamic = 1;
Oops, something went wrong.

0 comments on commit 4d439c6

Please sign in to comment.