1 | /***************************************
2 | $Revision: 1.13 $
3 |
4 | Status: NOT REVUED, NOT TESTED
5 |
6 | Author(s): Andrei Robachevsky
7 |
8 | ******************/ /******************
9 | Modification History:
10 | andrei (17/01/2000) Created.
11 | ******************/ /******************
12 | Copyright (c) 2000,2001,2002 RIPE NCC
13 |
14 | All Rights Reserved
15 |
16 | Permission to use, copy, modify, and distribute this software and its
17 | documentation for any purpose and without fee is hereby granted,
18 | provided that the above copyright notice appear in all copies and that
19 | both that copyright notice and this permission notice appear in
20 | supporting documentation, and that the name of the author not be
21 | used in advertising or publicity pertaining to distribution of the
22 | software without specific, written prior permission.
23 |
24 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
25 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
26 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
27 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
28 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30 | ***************************************/
31 |
32 | /* XXX IMPORTANT XXX */
33 | /* XXX Many of the definitions are hardcoded here XXX */
34 | /* XXX Incase of adding or reordering classes/attributes XXX */
35 | /* XXX Check this file, please XXX */
36 |
37 | /*********************************************************************
38 |
39 |
40 | This is needed for commit or rollback of the transaction (v3 software
41 | doesn't rely on transaction support from the underlying RDBMS; MySQL
42 | doesn't have it at all). The transaction in progress can be identified
43 | by thread_id field not being equal 0 in corresponding tables. According
44 | to the value of this field (insert or update) the commit/rollback
45 | routine either deletes or updates the record.
46 |
47 | The arrays have the following format: first come tables that may be
48 | affected when dummy object is created to resolve references. For
49 | example, if one creates a inetnum object that has no corresponding
50 | admin-c, tech-c, mnt-by, etc., dummy records will be created in
51 | person_role table and mntner table. We need to clean up them.
52 |
53 | Secondly (starting with TAB_START) come tables that may be affected by
54 | the object itself. Basically it is a list of all possible attributes of
55 | the object of the type that are stored in the db. I guess this may be
56 | also derived from xml in the future.
57 |
58 | And NULL is a delimiter; it is also used for padding.
59 |
60 | **********************************************************************/
61 |
62 | #define TAB_START 6
63 | char *t_ak[]={ "mntner","person_role","names",NULL,NULL,NULL,
64 | "admin_c","tech_c","notify","mnt_by","mnt_lower",NULL };
65 |
66 | char *t_an[]={ "mntner","person_role","as_set","names","mbrs_by_ref",NULL,
67 | "cross_nfy","cross_mnt","member_of","admin_c","tech_c","notify","mnt_by","mnt_lower","mnt_routes",NULL };
68 |
69 | char *t_dn[]={ "mntner","person_role","names",NULL,NULL,NULL,
70 | "admin_c","tech_c","zone_c","nserver","sub_dom","notify","mnt_by","mnt_lower","refer","inaddr_arpa", "ip6int", NULL }; /*C_DN, */
71 |
72 | char *t_i6[]={ "mntner","person_role","names","irt",NULL,NULL,
73 | "admin_c","tech_c","rev_srv","notify","mnt_by","mnt_lower","mnt_routes","mnt_irt",NULL}; /*C_I6,*/
74 |
75 | char *t_in[]={ "mntner","person_role","names","irt",NULL,NULL,
76 | "admin_c","tech_c","rev_srv","notify","mnt_by","mnt_lower","mnt_routes","mnt_irt",NULL}; /*C_IN,*/
77 |
78 | char *t_ir[]={ "mntner","person_role","names",NULL,NULL,NULL,
79 | "ifaddr","admin_c","tech_c","notify","mnt_by",NULL}; /*C_IR,*/
80 |
81 | char *t_kc[]={ "mntner",NULL,NULL,NULL,NULL,NULL,
82 | "notify","mnt_by",NULL}; /*C_KC,*/
83 |
84 | char *t_li[]={ "mntner","person_role","names",NULL,NULL,NULL,
85 | "admin_c","author","notify","mnt_by",NULL}; /*C_LI,*/
86 |
87 | char *t_mt[]={ "mntner","person_role","names",NULL,NULL,NULL,
88 | "admin_c","tech_c","upd_to","mnt_nfy","auth","notify","mnt_by","auth_override","referral_by",NULL}; /*C_MT,*/
89 |
90 | char *t_pn[]={ "mntner",NULL,NULL,NULL,NULL,NULL,
91 | "names","e_mail","notify","mnt_by",NULL}; /*C_PN,*/
92 |
93 | char *t_ro[]={ "mntner","person_role","names",NULL,NULL,NULL,
94 | "names","e_mail","admin_c","tech_c","notify","mnt_by",NULL}; /**C_RO,*/
95 |
96 | char *t_rt[]={ "route_set","mntner","person_role",NULL,NULL,NULL, /* admin-c, tech-c may appear in RADB */
97 | "cross_nfy","cross_mnt","member_of","notify","mnt_by","mnt_lower", "mnt_routes", NULL}; /*C_RT,*/
98 |
99 | char *t_as[]={ "mntner","person_role","names",NULL,NULL,NULL,
100 | "mbrs_by_ref","admin_c","tech_c","notify","mnt_by",NULL}; /*C_AS,*/
101 |
102 | char *t_rs[]={ "mntner","person_role","names",NULL,NULL,NULL,
103 | "mbrs_by_ref","admin_c","tech_c","notify","mnt_by",NULL}; /*C_RS,*/
104 |
105 | char *t_fs[]={ "mntner","person_role","names",NULL,NULL,NULL,
106 | "admin_c","tech_c","notify","mnt_by",NULL,NULL}; /*C_FS,*/
107 |
108 | char *t_ps[]={ "mntner","person_role","names",NULL,NULL,NULL,
109 | "admin_c","tech_c","notify","mnt_by",NULL,NULL}; /*C_PS,*/
110 |
111 | char *t_is[]={ "mntner","person_role","names",NULL,NULL,NULL,
112 | "mbrs_by_ref","admin_c","tech_c","notify","mnt_by",NULL}; /*C_IS,*/
113 |
114 | char *t_it[]={ "mntner","person_role","names",NULL,NULL,NULL,
115 | "admin_c","tech_c","notify","mnt_by","auth","irt_nfy",NULL}; /*C_IS,*/
116 |
117 | /* IMPORTANT !!! */
118 | /* This stuff should be consistent with DF_classnames.def */
119 |
120 | char **tables[]={
121 | t_ak,
122 | t_as,
123 | t_an,
124 | t_dn,
125 | t_ir,
126 | t_i6,
127 | t_in,
128 | t_kc,
129 | t_li,
130 | t_mt,
131 | t_pn,
132 | t_ro,
133 | t_rt,
134 | t_rs,
135 | t_fs,
136 | t_ps,
137 | t_is,
138 | t_it,
139 | NULL
140 | };
141 |
142 | /* This tables are used for inverse querying when deleting an object */
143 |
144 | char *t_ipn[]={ "admin_c","tech_c","zone_c","cross_nfy","author",NULL}; /*C_PN, C_RO*/
145 | char *t_imt[]={ "mnt_by","mnt_lower","mnt_routes","cross_mnt","mbrs_by_ref","referral_by",NULL}; /* C_MT */
146 | char *t_iit[]={ "mnt_irt", NULL}; /* C_IT */