--- acl.c.org Sat Jan 10 23:50:30 2004 +++ acl.c Sat Jan 10 23:49:48 2004 @@ -55,6 +55,7 @@ struct sockaddr_in ifru_addr; }; +/* Free HA structure */ void ast_free_ha(struct ast_ha *ha) { struct ast_ha *hal; @@ -64,6 +65,48 @@ free(hal); } } + /* Copy HA structure */ + void ast_copy_ha(struct ast_ha *from, struct ast_ha *to) + { + + memcpy(&to->netaddr, &from->netaddr, sizeof(from->netaddr)); + memcpy(&to->netmask, &from->netmask, sizeof(from->netmask)); + to->sense = from->sense; + to->next = from->next; /* Take care of next pointer later */ + + } + +/* Create duplicate of ha structure */ +struct ast_ha *ast_duplicate_ha(struct ast_ha *original) +{ + struct ast_ha *new_ha = malloc(sizeof(struct ast_ha)); + + /* Copy from original to new object */ + ast_copy_ha(original, new_ha); + + return(new_ha); + +} + +/* Create duplicate HA link list */ +struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original) +{ + struct ast_ha *start=original; + struct ast_ha *ret = NULL; + struct ast_ha *link,*prev; + + while(start) { + link = ast_duplicate_ha(start); /* Create copy of this object */ + prev->next = link; /* Link previous to this object */ + + if (!ret) ret = link; /* Save starting point */ + + start = start->next; /* Go to next object */ + prev = link; /* Save pointer to this object */ + } + return (ret); /* Return start of list */ + } + struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path) {