Source File up/dbupdate.h

    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 *sources[];
    77   |
    78   | typedef enum {
    79   |   UP_AUTH_OK=0, /* Auth succeded */
    80   |   UP_MOR, /* got more than one object from the db, where extected only one */
    81   |   UP_NSO, /* no such object */
    82   |   UP_AUF, /* auth failed */
    83   |   UP_NIY, /* not implemented yet */
    84   |   UP_ABN, /* as-block does not exist */
    85   |   UP_HOF, /* hierarchical auth failed */
    86   |   UP_OVF, /* override failed */
    87   |   UP_OVS, /* override syntax error */
    88   |   UP_NOM, /* no match. the old & nw versions of the object are not the same */
    89   |   UP_ANE, /* AUTO NIC hdl error */
    90   |   UP_FWD, /* mntner or as-block creation will be forwarded to <HUMAILBOX> */
    91   |   UP_SYN, /* syntax error in the object */
    92   |   UP_NAM, /* name of a person/role object cannot be changed */
    93   |   UP_INT  /* internal error */
    94   |
    95   | } return_codes;
    96   |
    97   | typedef struct _up_ripupd_result_struct {
    98   |   int result;
    99   |   char * error_str;
    100  | } up_ripupd_result_struct;
    101  |
    102  |
    103  |
    104  | up_ripupd_result_struct * send_object_db(rpsl_object_t * object, char * assigned_NIC, char * operation);
    105  |
    106  | /* char * get_class_type(Object *arg); */
    107  |
    108  | char * get_search_key(rpsl_object_t *object, const char * type);
    109  |
    110  | /* GSList *get_attributes(Object * o, const char * attrib, const char * text); */
    111  |
    112  | char * send_and_get(char * host, int port, char * arg);
    113  |
    114  | int count_objects(char * arg);
    115  |
    116  | char * take_object(char * arg);
    117  |
    118  | char * get_as_block(rpsl_object_t *autnum_object);
    119  |
    120  | char * get_less_specific_domain(rpsl_object_t *domain_object);
    121  |
    122  | char * get_less_specific_set(rpsl_object_t *set_object, const char *type);
    123  |
    124  | char * get_less_specific(rpsl_object_t *inetnum_object, const char *type);
    125  |
    126  | GList *get_mntners(rpsl_object_t * object);
    127  |
    128  | GList *get_auths(char * object_str);
    129  |
    130  | GList *get_attr_list(rpsl_object_t * object, const char * attr_type);
    131  |
    132  | GList *get_mnt_lowers(rpsl_object_t * object);
    133  |
    134  | char *get_override(rpsl_object_t * object);
    135  |
    136  | int check_override(char * string);
    137  |
    138  | GSList * add_to_auth_vector(GSList * list_of_auth_struct, GList * auths, char * mntner_name);
    139  |
    140  | GSList * get_auth_vector(GList * mntners);
    141  |
    142  | GList * get_mntnfy_vector(GList * mntners);
    143  |
    144  | int check_auth(rpsl_object_t *new_object, rpsl_object_t *old_object, const char *type, credentials_struct credentials);
    145  |
    146  | char * get_old_version(rpsl_object_t * object, char * arg);
    147  |
    148  | /* int process_object(char * arg, credentials_struct credentials, GHashTable * NIC_hdl_hash, char * ack_file_name); */
    149  |
    150  | void process_mail_header(credentials_struct * credentials_ptr ,char * header);
    151  |
    152  | int has_ref_to_AUTO_nic_hdl(rpsl_object_t * object);
    153  |
    154  | char * find_email_address(const char * from_line);
    155  |
    156  | char * replace_refs_to_AUTO_NIC_hdl(rpsl_object_t * object, GHashTable * auto_nic_hash , char *arg);
    157  |
    158  | int identical(const char * old_version, rpsl_object_t * object);
    159  |
    160  | int has_AUTO_NIC_hdl(const rpsl_object_t * object);
    161  |
    162  | rpsl_object_t * replace_AUTO_NIC_hdl(rpsl_object_t * object, char * auto_nic_hdl);
    163  |
    164  | /* char * get_class_type_char(char * object); */
    165  |
    166  | void up_string_pack(char *dest, const char *source);
    167  |
    168  | void UP_add_to_upd_log(const char * filename);
    169  |
    170  | void UP_log_networkupdate(const char * object_str, const char * host);
    171  |
    172  |
    173  | #endif