include/nh.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- NH_commit
- NH_rollback
1 /***************************************
2 $Revision: 1.3 $
3
4 Status: NOT REVUED, NOT TESTED
5
6 Author(s): Andrei Robachevsky
7
8 ******************/ /******************
9 Modification History:
10 andrei (10/04/2000) Created.
11 ******************/ /******************
12 Copyright (c) 2000 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 #ifndef _NH_H
32 #define _NH_H
33
34 /************************************************************
35 * *
36 * NHR is capable of handling nic-handles __ONLY__ *
37 * of the following format: *
38 * *
39 * Acceptable format is: *
40 * [A-Z][A-Z]*[1-9][0-9]*(-[A-Z][A-Z]*)? *
41 * *
42 ************************************************************/
43 #include <mysql_driver.h>
44
45 #define MAX_NH_LENGTH 64
46 #define MAX_NH_SPACE_LENGTH 5
47 #define MAX_NH_SOURCE_LENGTH 10
48
49 #define MAX_NIC_ID 999999
50 #define NULL_NIC_ID (0)
51 #define AUTO_NIC_ID (-1)
52 #define MIN_NIC_ID (-2)
53 #define MAX_RANGE (MAX_NIC_ID+1)
54 #define MIN_RANGE NULL_NIC_ID
55
56 #define NH_DELETE 1000
57 #define NH_INSERT 2000
58
59 typedef struct _range_t {
60 long start;
61 long end;
62 char *space;
63 char *source;
64 } range_t;
65
66 /* structure to save nic handle data */
67 typedef struct _nic_handle_t {
68 long nic_id;
69 char *space;
70 char *source;
71 } nic_handle_t;
72
73 int NH_check(nic_handle_t *pnh, SQ_connection_t *sql_connection);
74 int NH_free(nic_handle_t *pnh, SQ_connection_t *sql_connection, int commit_now);
75 int NH_register(nic_handle_t *pnh, SQ_connection_t *sql_connection, int commit_now);
76
77 char *NH_convert(nic_handle_t *pnh);
78 int NH_parse(char *nic, nic_handle_t **pnh);
79
80 void free_nh(nic_handle_t *nh_ptr);
81
82 int NH_comrol(SQ_connection_t *sql_connection, int thread_ins, int thread_del);
83 #define NH_commit(sql_connection) NH_comrol(sql_connection, NH_INSERT, NH_DELETE)
/* [<][>][^][v][top][bottom][index][help] */
84 #define NH_rollback(sql_connection) NH_comrol(sql_connection, NH_DELETE, NH_INSERT)
/* [<][>][^][v][top][bottom][index][help] */
85
86
87 #endif /* _NH_H */