diff options
author | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:09:40 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:18:19 +0100 |
commit | 96d380405701bb01d792ff1c867a607d7fefa001 (patch) | |
tree | 08477327585a486667ade126b9bd51713e461608 /lib | |
parent | 34e803c6c32032cffeb9bd230d0f85861acd9222 (diff) | |
parent | 8478de8817c58af02f7aed1d621013891115a2dc (diff) |
Merge commit '8478de88' into thread-next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attrs.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/attrs.h b/lib/attrs.h index af2f1036..b4dd2e83 100644 --- a/lib/attrs.h +++ b/lib/attrs.h @@ -170,6 +170,11 @@ static inline const char *ec_subtype_str(const enum ec_subtype ecs) { } } +/* Check for EC_RT subtype within different types (0-2) */ +static inline int ec_type_is_rt(uint type) +{ return (type == EC_RT) || (type == (0x0100 | EC_RT)) || (type == (0x0200 | EC_RT)); } + + /* Transitive bit (for first u32 half of EC) */ #define EC_TBIT 0x40000000 @@ -189,9 +194,13 @@ static inline u32 *int_set_get_data(const struct adata *list) static inline u32 ec_hi(u64 ec) { return ec >> 32; } static inline u32 ec_lo(u64 ec) { return ec; } + static inline u64 ec_get(const u32 *l, int i) { return (((u64) l[i]) << 32) | l[i+1]; } +static inline void ec_put(u32 *l, int i, u64 val) +{ l[i] = ec_hi(val); l[i+1] = ec_lo(val); } + /* RFC 4360 3.1. Two-Octet AS Specific Extended Community */ static inline u64 ec_as2(enum ec_subtype kind, u64 key, u64 val) { return (((u64) kind | 0x0000) << 48) | (key << 32) | val; } |