| := | Override the attribute with the contents with the _<rhs>_. If the attribute already exists, its value is over-written. If the attribute does not exist, it is created, and the contents set to thex value of the _<rhs>_
| += | Perform string append. The contents of the _<rhs>_ are appended to the _<attribute>_.
| -= | Inverse of string append. The contents of the _<rhs>_ are deleted from from the _<attribute>_, if the `_<rhs>_` is a suffix of _<attribute>_
-| ^= | Perform string prepend. The contents of the _<rhs>_ are prepended to the _<attribute>_.
+| ^= | Perform logical "xor". The contents of the _<rhs>_ are "xor"ed with the contents of the _<rhs>_. Both strings must be of the same length.
| \|= | Perform logical "or". The value of the _<attribute>_ is "or"ed with the contents of the _<rhs>_. Both strings must be of the same length.
| \&= | Perform logical "and". The value of the _<attribute>_ is "and"ed with the contents of the _<rhs>_. Both strings must be of the same length.
| \<<= | Perform left shift / truncation. The first _<rhs>_ bytes of _<attribute>_ are dropped. i.e. shifted off of the start of the string.
len = a->length + b->length;
switch (op) {
- case T_OP_PREPEND: /* dst = b . a */
+ case T_ADD: /* dst = a . b */
buf = talloc_array(ctx, uint8_t, len);
if (!buf) {
oom:
return -1;
}
- memcpy(buf, b->vb_octets, b->vb_length);
- memcpy(buf + b->vb_length, a->vb_octets, a->vb_length);
-
- fr_value_box_memdup_shallow(dst, dst->enumv, buf, len, a->tainted | b->tainted);
- break;
-
- case T_ADD: /* dst = a . b */
- buf = talloc_array(ctx, uint8_t, len);
- if (!buf) goto oom;
-
memcpy(buf, a->vb_octets, a->vb_length);
memcpy(buf + a->vb_length, b->vb_octets, b->vb_length);
len = a->length + b->length;
switch (op) {
- case T_OP_PREPEND: /* dst = b . a */
+ case T_ADD:
buf = talloc_array(ctx, char, len + 1);
if (!buf) {
oom:
return -1;
}
- len = a->vb_length + b->vb_length;
- memcpy(buf, b->vb_strvalue, b->vb_length);
- memcpy(buf + b->vb_length, a->vb_strvalue, a->vb_length);
- buf[len] = '\0';
-
- fr_value_box_bstrndup_shallow(dst, dst->enumv, buf, len, a->tainted | b->tainted);
- break;
-
- case T_ADD:
- buf = talloc_array(ctx, char, len + 1);
- if (!buf) goto oom;
-
len = a->vb_length + b->vb_length;
memcpy(buf, a->vb_strvalue, a->vb_length);
memcpy(buf + a->vb_length, b->vb_strvalue, b->vb_length);
*/
if (hint == FR_TYPE_NULL) do {
switch (op) {
- case T_OP_PREPEND:
- /*
- * Pick the existing type if we have a
- * variable-sized type. Otherwise, pick
- * octets.
- */
- if (fr_type_is_variable_size(a->type)) {
- hint = a->type;
-
- } else if (fr_type_is_variable_size(b->type)) {
- hint = b->type;
-
- } else {
- hint = FR_TYPE_OCTETS;
- }
- break;
-
case T_OP_CMP_EQ:
case T_OP_NE:
case T_OP_GE:
case T_DIV:
case T_AND:
case T_OR:
- case T_OP_PREPEND:
case T_RSHIFT:
case T_LSHIFT:
fr_assert(hint != FR_TYPE_NULL);
rcode = fr_value_calc_binary_op(ctx, &out, dst->type, dst, T_SUB, src);
break;
- case T_OP_PREPEND:
- rcode = fr_value_calc_binary_op(ctx, dst, dst->type, dst, op, src);
- break;
-
case T_OP_AND_EQ:
rcode = fr_value_calc_binary_op(ctx, &out, dst->type, dst, T_OR, src);
break;