Skip to content

Commit

Permalink
trafic class/classifer API improvements and documentation
Browse files Browse the repository at this point in the history
- removed dead functions in header files
- deprecated rtnl_class_foreach_*() functions due to their missing
  handling possibility of OOM situations
- improved API documentation
  • Loading branch information
tgraf committed Mar 29, 2011
1 parent 747b892 commit 7c62050
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 266 deletions.
32 changes: 18 additions & 14 deletions include/netlink/route/class.h
@@ -1,12 +1,12 @@
/*
* netlink/route/class.h Classes
* netlink/route/class.h Traffic Classes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/

#ifndef NETLINK_CLASS_H_
Expand All @@ -22,38 +22,42 @@ extern "C" {

struct rtnl_class;

extern struct rtnl_class * rtnl_class_alloc(void);
extern struct rtnl_class *
rtnl_class_alloc(void);
extern void rtnl_class_put(struct rtnl_class *);

extern int rtnl_class_alloc_cache(struct nl_sock *, int,
struct nl_cache **);
extern struct rtnl_class *rtnl_class_get(struct nl_cache *, int, uint32_t);
extern struct rtnl_class *
rtnl_class_get(struct nl_cache *, int, uint32_t);

/* leaf qdisc access */
extern struct rtnl_qdisc * rtnl_class_leaf_qdisc(struct rtnl_class *,
extern struct rtnl_qdisc *
rtnl_class_leaf_qdisc(struct rtnl_class *,
struct nl_cache *);

extern int rtnl_class_build_add_request(struct rtnl_class *, int,
struct nl_msg **);
extern int rtnl_class_add(struct nl_sock *, struct rtnl_class *,
int);

extern int rtnl_class_build_delete_request(struct rtnl_class *,
struct nl_msg **);
extern int rtnl_class_delete(struct nl_sock *, struct rtnl_class *);

extern void rtnl_class_set_kind(struct rtnl_class *, const char *);
extern int rtnl_class_build_delete_request(struct rtnl_class *,
struct nl_msg **);
extern int rtnl_class_delete(struct nl_sock *,
struct rtnl_class *);

/* iterators */
/* deprecated functions */
extern void rtnl_class_foreach_child(struct rtnl_class *,
struct nl_cache *,
void (*cb)(struct nl_object *,
void *),
void *);
void *)
__attribute__((deprecated));
extern void rtnl_class_foreach_cls(struct rtnl_class *,
struct nl_cache *,
void (*cb)(struct nl_object *,
void *),
void *);
void *)
__attribute__((deprecated));

#ifdef __cplusplus
}
Expand Down
33 changes: 17 additions & 16 deletions include/netlink/route/classifier.h
Expand Up @@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/

#ifndef NETLINK_CLASSIFIER_H_
Expand All @@ -22,26 +22,27 @@ extern "C" {
#endif

extern struct rtnl_cls *rtnl_cls_alloc(void);
extern void rtnl_cls_put(struct rtnl_cls *);
extern void rtnl_cls_put(struct rtnl_cls *);

extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t,
struct nl_cache **);
extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t,
struct nl_cache **);

extern int rtnl_cls_build_add_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int);
extern int rtnl_cls_build_add_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int);

extern int rtnl_cls_build_change_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_build_delete_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *, int);
extern int rtnl_cls_build_change_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_build_delete_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *,
int);

extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *);
extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *);

extern void rtnl_cls_set_protocol(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_protocol(struct rtnl_cls *);
extern void rtnl_cls_set_protocol(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_protocol(struct rtnl_cls *);

#ifdef __cplusplus
}
Expand Down

0 comments on commit 7c62050

Please sign in to comment.