xref: /openbsd/usr.bin/cvs/remote.h (revision ce7279d8)
1 /*	$OpenBSD: remote.h,v 1.39 2024/05/21 05:00:48 jsg Exp $	*/
2 /*
3  * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef H_REMOTE
19 #define H_REMOTE
20 
21 struct cvs_req {
22 	char	name[32];
23 	int	supported;
24 
25 	void	(*hdlr)(char *);
26 	int	flags;
27 };
28 
29 struct cvs_resp {
30 	char	name[32];
31 	int	supported;
32 
33 	void	(*hdlr)(char *);
34 	int	flags;
35 };
36 
37 #define	REQ_NEEDED	0x01
38 #define REQ_NEEDDIR	0x02
39 
40 #define RESP_NEEDED	0x01
41 
42 extern int server_response;
43 
44 #define SERVER_OK	0
45 #define SERVER_ERROR	1
46 
47 #define CVS_SERVER_UNCHANGED		"d[o.o]b"
48 #define CVS_SERVER_UPTODATE		(time_t)-2
49 #define CVS_SERVER_QUESTIONABLE		'?'
50 
51 void	cvs_client_connect_to_server(void);
52 void	cvs_client_send_logmsg(char *);
53 void	cvs_client_send_request(char *, ...)
54 	__attribute__((format(printf, 1, 2)));
55 void	cvs_client_read_response(void);
56 void	cvs_client_get_responses(void);
57 
58 void	cvs_client_ok(char *);
59 void	cvs_client_error(char *);
60 void	cvs_client_validreq(char *);
61 void	cvs_client_e(char *);
62 void	cvs_client_m(char *);
63 void	cvs_client_checkedin(char *);
64 void	cvs_client_updated(char *);
65 void	cvs_client_merged(char *);
66 void	cvs_client_removed(char *);
67 void	cvs_client_remove_entry(char *);
68 void	cvs_client_set_static_directory(char *);
69 void	cvs_client_clear_static_directory(char *);
70 void	cvs_client_set_sticky(char *);
71 void	cvs_client_clear_sticky(char *);
72 
73 void	cvs_client_senddir(const char *);
74 void	cvs_client_sendfile(struct cvs_file *);
75 void	cvs_client_send_files(char **, int);
76 
77 void	cvs_server_root(char *);
78 void	cvs_server_send_response(char *, ...)
79 	__attribute__((format(printf, 1, 2)));
80 void	cvs_server_validresp(char *);
81 void	cvs_server_validreq(char *);
82 void	cvs_server_globalopt(char *);
83 void	cvs_server_directory(char *);
84 void	cvs_server_entry(char *);
85 void	cvs_server_modified(char *);
86 void	cvs_server_useunchanged(char *);
87 void	cvs_server_unchanged(char *);
88 void	cvs_server_questionable(char *);
89 void	cvs_server_argument(char *);
90 void	cvs_server_argumentx(char *);
91 void	cvs_server_set(char *);
92 void	cvs_server_static_directory(char *);
93 void	cvs_server_sticky(char *);
94 void	cvs_server_update_patches(char *);
95 void	cvs_server_update_entry(const char *, struct cvs_file *cf);
96 void	cvs_server_set_sticky(const char *, char *);
97 void	cvs_server_clear_sticky(char *);
98 void	cvs_server_exp_modules(char *);
99 
100 void	cvs_server_add(char *);
101 void	cvs_server_import(char *);
102 void	cvs_server_admin(char *);
103 void	cvs_server_annotate(char *);
104 void	cvs_server_commit(char *);
105 void	cvs_server_checkout(char *);
106 void	cvs_server_diff(char *);
107 void	cvs_server_export(char *);
108 void	cvs_server_init(char *);
109 void	cvs_server_log(char *);
110 void	cvs_server_rannotate(char *);
111 void	cvs_server_rdiff(char *);
112 void	cvs_server_release(char *);
113 void	cvs_server_remove(char *);
114 void	cvs_server_rlog(char *);
115 void	cvs_server_rtag(char *);
116 void	cvs_server_status(char *);
117 void	cvs_server_tag(char *);
118 void	cvs_server_update(char *);
119 void	cvs_server_version(char *);
120 
121 void	cvs_remote_classify_file(struct cvs_file *);
122 void	cvs_remote_output(char *);
123 char	*cvs_remote_input(void);
124 void	cvs_remote_receive_file(int, size_t);
125 void	cvs_remote_send_file(const char *, int);
126 void	cvs_remote_send_file_buf(char *, BUF *, mode_t);
127 
128 extern int cvs_client_inlog_fd;
129 extern int cvs_client_outlog_fd;
130 
131 extern struct cvs_req cvs_requests[];
132 extern struct cvs_resp cvs_responses[];
133 
134 struct cvs_req *cvs_remote_get_request_info(const char *);
135 struct cvs_resp *cvs_remote_get_response_info(const char *);
136 
137 void	cvs_validate_directory(const char *);
138 
139 #endif
140