]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] stick-table: provide a table lookup function
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2010 15:26:50 +0000 (17:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Aug 2010 16:04:12 +0000 (18:04 +0200)
We'll often need to lookup a table by its name. This will change
in the future once we can resolve these names on startup.

include/proto/stick_table.h
src/stick_table.c

index 813b3b971600325f481cd2adcd1acc0e090d2491..38ec9ae8f24d2f8f42d92ed6de75680cedd5811c 100644 (file)
@@ -46,6 +46,7 @@ struct stktable_key *stktable_fetch_key(struct proxy *px, struct session *l4,
                                        unsigned long table_type);
 int stktable_compatible_pattern(struct pattern_expr *expr, unsigned long table_type);
 int stktable_get_data_type(char *name);
+struct proxy *find_stktable(const char *name);
 
 /* reserve some space for data type <type>. Return non-0 if OK, or 0 if already
  * allocated (or impossible type).
index f490384234a473fa81b28c6abdfe7fff0af8b071..a5e41bf73da71ca6e60fb32c27eafbe023898058 100644 (file)
@@ -544,3 +544,14 @@ int stktable_get_data_type(char *name)
        return -1;
 }
 
+/* Returns pointer to proxy containing table <name> or NULL if not found */
+struct proxy *find_stktable(const char *name)
+{
+       struct proxy *px;
+
+       for (px = proxy; px; px = px->next) {
+               if (px->table.size && strcmp(px->id, name) == 0)
+                       return px;
+       }
+       return NULL;
+}