## modules/up/dbupdate.h

/* [<][>][^][v][top][bottom][index][help] */

## DEFINITIONS

This source file includes following functions.

1. UP_AUTH_OK
2. UP_MOR
3. UP_NSO
4. UP_AUF
5. UP_NIY
6. UP_ABN
7. UP_HOF
8. UP_OVF
9. UP_OVS
10. UP_NOM
11. UP_ANE
12. UP_FWD
13. UP_SYN
14. UP_NAM
15. UP_INT
16. UP_MFF
17. UP_MIX
18. UP_OKM
19. return_codes
20. up_ripupd_result_struct

       1 /******************
       2   Copyright (c) 2002                                        RIPE NCC
       3
       4   All Rights Reserved
       5
       6   Permission to use, copy, modify, and distribute this software and its
       7   documentation for any purpose and without fee is hereby granted,
       8   provided that the above copyright notice appear in all copies and that
       9   both that copyright notice and this permission notice appear in
      10   supporting documentation, and that the name of the author not be
      11   used in advertising or publicity pertaining to distribution of the
      12   software without specific, written prior permission.
      13
      14   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      15   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      16   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      17   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      18   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      19   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      20   ***************************************/
      21
      22 #ifndef UPDATE_UPPER_H
      23 #define UPDATE_UPPER_H
      24
      25
      26 #include <stdio.h>
      27 #include <stdlib.h>
      28 #include <string.h>
      29 #include <stubs.h>
      30 /*#include <string>*/
      31 #include <glib.h>
      32 /*#include <iostream.h>
      33 #include <fstream>*/
      34
      35 #include <netdb.h>
      36 #include <sys/types.h>
      37 #include <netinet/in.h>
      38 #include <sys/socket.h>
      39 #include <errno.h>
      40 #include <unistd.h>
      41
      42 #include "rip.h"
      43 #undef close
      44
      45 #include <config.h>
      46 /* #include <istream.h>
      47 #include "rpsl/object.hh"
      48 #include "util/rusage.hh"
      49 #include "util/debug.hh"
      50 #include "util/trace.hh"
      51 #include "util/Argv.hh"
      52 #include "util/version.hh"
      53 #ifdef IRR_NEEDED
      54 #include "irr/irr.hh"
      55 #include "irr/rawhoisc.hh"
      56 #endif */ /* IRR_NEEDED */
      57 /* #include "rpsl/schema.hh"
      58 */
      59 #include "erroutines.h"
      60 #include "AU_util.h"
      61 #include "ack.h"
      62 #define private private_xx
      63 #include "mm.h"
      64 #include "mysql_driver.h"
      65 /*#include "mail_parser.h"*/
      66 #undef private
      67
      68
      69 #define MAXDATASIZE 100 /* max number of bytes we can get at once */
      70
      71 #define OVR_OK 0 /* override succeded */
      72
      73
      74 #define ACK_FILE_PREFIX "ack"
      75
      76 extern char *current_source;
      77
      78 typedef enum {
      79   UP_AUTH_OK=0, /* Auth succeded */
         /* [<][>][^][v][top][bottom][index][help] */
      80   UP_MOR, /* got more than one object from the db, where extected only one */
         /* [<][>][^][v][top][bottom][index][help] */
      81   UP_NSO, /* no such object */
         /* [<][>][^][v][top][bottom][index][help] */
      82   UP_AUF, /* auth failed */
         /* [<][>][^][v][top][bottom][index][help] */
      83   UP_NIY, /* not implemented yet */
         /* [<][>][^][v][top][bottom][index][help] */
      84   UP_ABN, /* as-block does not exist */
         /* [<][>][^][v][top][bottom][index][help] */
      85   UP_HOF, /* hierarchical auth failed */
         /* [<][>][^][v][top][bottom][index][help] */
      86   UP_OVF, /* override failed */
         /* [<][>][^][v][top][bottom][index][help] */
      87   UP_OVS, /* override syntax error */
         /* [<][>][^][v][top][bottom][index][help] */
      88   UP_NOM, /* no match. the old & nw versions of the object are not the same */
         /* [<][>][^][v][top][bottom][index][help] */
      89   UP_ANE, /* AUTO NIC hdl error */
         /* [<][>][^][v][top][bottom][index][help] */
      90   UP_FWD, /* mntner or as-block creation will be forwarded to <HUMAILBOX> */
         /* [<][>][^][v][top][bottom][index][help] */
      91   UP_SYN, /* syntax error in the object */
         /* [<][>][^][v][top][bottom][index][help] */
      92   UP_NAM, /* name of a person/role object cannot be changed */
         /* [<][>][^][v][top][bottom][index][help] */
      93   UP_INT, /* internal error */
         /* [<][>][^][v][top][bottom][index][help] */
      94   UP_MFF, /* failed with MAIL-FROM auth method only */
         /* [<][>][^][v][top][bottom][index][help] */
      95   UP_MIX, /* failed with mix of MAIL-FROM and other auth methods */
         /* [<][>][^][v][top][bottom][index][help] */
      96   UP_OKM  /* Auth succeded but also contained a deprecated MAIL-FROM */
         /* [<][>][^][v][top][bottom][index][help] */
      97
      98 } return_codes;
         /* [<][>][^][v][top][bottom][index][help] */
      99
     100 typedef struct _up_ripupd_result_struct {
     101   int result;
     102   char * error_str;
     103 } up_ripupd_result_struct;
         /* [<][>][^][v][top][bottom][index][help] */
     104
     105
     106
     107 up_ripupd_result_struct * send_object_db(rpsl_object_t * object, char * assigned_NIC, char * operation);
     108
     109 /* char * get_class_type(Object *arg); */
     110
     111 char * get_search_key(rpsl_object_t *object, const char * type);
     112
     113 /* GSList *get_attributes(Object * o, const char * attrib, const char * text); */
     114
     115 char * send_and_get(char * host, int port, char * arg);
     116
     117 int count_objects(char * arg);
     118
     119 char * take_object(char * arg);
     120
     121 char * get_as_block(rpsl_object_t *autnum_object);
     122
     123 char * get_less_specific_domain(rpsl_object_t *domain_object);
     124
     125 char * get_less_specific_set(rpsl_object_t *set_object, const char *type);
     126
     127 char * get_less_specific(rpsl_object_t *inetnum_object, const char *type);
     128
     129 GList *get_mntners(rpsl_object_t * object);
     130
     131 GList *get_auths(char * object_str);
     132
     133 GList *get_attr_list(rpsl_object_t * object, const char * attr_type);
     134
     135 GList *get_mnt_lowers(rpsl_object_t * object);
     136
     137 char *get_override(rpsl_object_t * object);
     138
     139 int check_override(char * string);
     140
     141 GSList * add_to_auth_vector(GSList * list_of_auth_struct, GList * auths, char * mntner_name);
     142
     143 GSList * get_auth_vector(GList * mntners);
     144
     145 GList * get_mntnfy_vector(GList * mntners);
     146
     147 int check_auth(rpsl_object_t *new_object, rpsl_object_t *old_object, const char *type, credentials_struct credentials);
     148
     149 char * get_old_version(rpsl_object_t * object, char * arg);
     150
     151 /* int process_object(char * arg, credentials_struct credentials, GHashTable * NIC_hdl_hash, char * ack_file_name); */
     152
     153 void process_mail_header(credentials_struct * credentials_ptr ,char * header);
     154
     155 int has_ref_to_AUTO_nic_hdl(rpsl_object_t * object);
     156
     157 char * find_email_address(const char * from_line);
     158
     159 char * replace_refs_to_AUTO_NIC_hdl(rpsl_object_t * object, GHashTable * auto_nic_hash , char *arg);
     160
     161 int identical(const char * old_version, rpsl_object_t * object);
     162
     163 int has_AUTO_NIC_hdl(const rpsl_object_t * object);
     164
     165 rpsl_object_t * replace_AUTO_NIC_hdl(rpsl_object_t * object, char * auto_nic_hdl);
     166
     167 /* char * get_class_type_char(char * object); */
     168
     169 void up_string_pack(char *dest, const char *source);
     170
     171 void UP_add_to_upd_log(const char * filename);
     172
     173 void UP_log_networkupdate(const char * object_str, const char * host);
     174
     175
     176 #endif

/* [<][>][^][v][top][bottom][index][help] */