This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[samba.git] / source3 / wrepld / wins_repl.h
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines
4  *  Copyright (C) Jean François Micouleau      1998-2002.
5  *  
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 #define OPCODE_NON_NBT  0x00007800
22
23 /* the messages */
24 #define MESSAGE_TYPE_START_ASSOC_REQUEST        0
25 #define MESSAGE_TYPE_START_ASSOC_REPLY          1
26 #define MESSAGE_TYPE_STOP_ASSOC                 2
27 #define MESSAGE_TYPE_REPLICATE                  3
28
29 /* the replication sub-message */
30 #define MESSAGE_REP_ADD_VERSION_REQUEST         0
31 #define MESSAGE_REP_ADD_VERSION_REPLY           1
32 #define MESSAGE_REP_SEND_ENTRIES_REQUEST        2
33 #define MESSAGE_REP_SEND_ENTRIES_REPLY          3
34 #define MESSAGE_REP_UPDATE_NOTIFY_REQUEST       4
35
36 /* stop reasons */
37 #define STOP_REASON_USER_REASON                 0
38 #define STOP_REASON_AUTH_FAILED                 1
39 #define STOP_REASON_INCOMPLETE_VERSION          2
40 #define STOP_REASON_BUG_CHECK                   3
41 #define STOP_REASON_MESSAGE_ERROR               4
42
43
44 typedef struct _WINS_OWNER {
45         struct in_addr address;
46         SMB_BIG_UINT max_version;
47         SMB_BIG_UINT min_version;
48         int type;
49         time_t last_pull;
50         time_t last_push;
51 } WINS_OWNER;
52
53 typedef struct _WINS_NAME {
54         int name_len; /* always 0x11 */
55         char name[16];
56         char type;
57         int empty;
58         int name_flag;
59         int group_flag;
60         SMB_BIG_UINT id;
61         int num_ip;
62         struct in_addr owner;
63         struct in_addr *others;
64         int foo; /* 0xffffff */
65 } WINS_NAME;
66         
67 typedef struct _WINS_PARTNERS
68 {
69         int client_assoc;
70         int server_assoc;
71         BOOL pull_partner;
72         BOOL push_partner;
73         struct in_addr partner_server;
74         struct in_addr other_server;
75 } WINS_PARTNER;
76
77 typedef struct _generic_header{
78         int data_size;
79         int opcode;
80         int assoc_ctx;
81         int mess_type;
82 } generic_header;
83
84 typedef struct _START_ASSOC_REQUEST {
85         int assoc_ctx;
86         int min_ver;
87         int maj_ver;
88 } START_ASSOC_REQUEST;
89
90 typedef struct _START_ASSOC_REPLY {
91         int assoc_ctx;
92         int min_ver;
93         int maj_ver;
94 } START_ASSOC_REPLY;
95
96 typedef struct _STOP_ASSOC {
97         int reason;
98 } STOP_ASSOC;
99
100 typedef struct _AVMT_REP {
101         int partner_count;
102         WINS_OWNER *wins_owner;
103         struct in_addr initiating_wins_server;
104 } AVMT_REP;
105
106 typedef struct _SEND_ENTRIES_REQUEST {
107         WINS_OWNER wins_owner;
108 } SEND_ENTRIES_REQUEST;
109
110 typedef struct _SEND_ENTRIES_REPLY {
111         int max_names;
112         WINS_NAME *wins_name;   
113 } SEND_ENTRIES_REPLY;
114
115 typedef struct  _UPDATE_NOTIFY_REQUEST {
116         int partner_count;
117         WINS_OWNER *wins_owner; 
118         struct in_addr initiating_wins_server;
119 } UPDATE_NOTIFY_REQUEST;
120
121 typedef struct _REPLICATE {
122         int msg_type;
123         
124         AVMT_REP avmt_rep;
125         SEND_ENTRIES_REQUEST se_rq;
126         SEND_ENTRIES_REPLY se_rp;
127         UPDATE_NOTIFY_REQUEST un_rq;
128 } REPLICATE;
129
130
131 typedef struct _GENERIC_PACKET {
132         int fd;
133
134         generic_header header;
135
136         START_ASSOC_REQUEST sa_rq;
137         START_ASSOC_REPLY sa_rp;
138         STOP_ASSOC so;
139         REPLICATE rep;
140 } GENERIC_PACKET;
141
142 struct wins_packet_struct
143 {
144         struct wins_packet_struct *next;
145         struct wins_packet_struct *prev;
146         BOOL stop_packet;
147         int fd;
148         time_t timestamp;
149         GENERIC_PACKET *packet;
150 };
151
152 struct BUFFER {
153         char *buffer;
154         int offset;
155         int length;
156 };
157
158
159
160 #include "wrepld_proto.h"
161