1 | /***************************************
2 | $Revision: 1.12 $
3 |
4 | Functions to interface with RX module (create/update rx-nodes)
5 |
6 | Status: NOT REVUED, NOT TESTED
7 |
8 | Author(s): Andrei Robachevsky
9 |
10 | ******************/ /******************
11 | Modification History:
12 | andrei (17/01/2000) Created.
13 | ******************/ /******************
14 | Copyright (c) 2000,2001,2002 RIPE NCC
15 |
16 | All Rights Reserved
17 |
18 | Permission to use, copy, modify, and distribute this software and its
19 | documentation for any purpose and without fee is hereby granted,
20 | provided that the above copyright notice appear in all copies and that
21 | both that copyright notice and this permission notice appear in
22 | supporting documentation, and that the name of the author not be
23 | used in advertising or publicity pertaining to distribution of the
24 | software without specific, written prior permission.
25 |
26 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
28 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
29 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
30 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
31 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 | ***************************************/
33 |
34 | #include "rip.h"
35 |
36 | /* Function to fill data for radix tree */
37 | void get_rx_data(void *element_data, void *tr_ptr)
38 | {
39 | const rpsl_attr_t *attribute = (const rpsl_attr_t *)element_data;
40 | Transaction_t *tr = (Transaction_t *)tr_ptr;
41 | int attribute_type = rpsl_get_attr_id(rpsl_attr_get_name(attribute));
42 |
43 | const gchar *attribute_value;
44 |
45 | switch(attribute_type){
46 | case A_IN:
47 | case A_RT:
48 | case A_I6:
49 | case A_DN:
50 | /* it is already clean as we work with the flattened object */
51 | attribute_value = rpsl_attr_get_value(attribute);
52 | if( RP_asc2pack( tr->packptr, attribute_type, attribute_value) != IP_OK ) {
53 | dieif( attribute_type != A_DN ); /* DN can be forgiven, but radix should not be updated */
54 | } else tr->action |= TA_UPD_RX; /* Update radix in all other cases */
55 | break;
56 | default: break;
57 | }
58 | }