1 /* $NetBSD: talk_ctl.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */
4 * Copyright (c) 1983-2003, Regents of the University of California.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * + Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * + Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * + Neither the name of the University of California, San Francisco nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/types.h>
35 #include <netinet/in.h>
38 #include <protocols/talkd.h>
41 #include <sys/socket.h>
45 #ifndef MAXHOSTNAMELEN
46 #define MAXHOSTNAMELEN 256
49 #define MAX_LIFE 60 /* max time daemon saves invitations */
50 /* RING_WAIT should be 10's of seconds less than MAX_LIFE */
51 #define RING_WAIT 30 /* time to wait before refreshing invitation */
54 #define LEAVE_INVITE 0
63 #define MACHINE_UNKNOWN 3
64 #define PERMISSION_DENIED 4
65 #define UNKNOWN_REQUEST 5
67 typedef struct ctl_response
{
71 struct sockaddr_in addr
;
74 typedef struct ctl_msg
{
76 char l_name
[NAME_SIZE
];
77 char r_name
[NAME_SIZE
];
81 struct sockaddr_in addr
;
82 struct sockaddr_in ctl_addr
;
91 extern struct sockaddr_in daemon_addr
;
92 extern struct sockaddr_in ctl_addr
;
93 extern struct sockaddr_in my_addr
;
94 extern struct in_addr my_machine_addr
;
95 extern struct in_addr his_machine_addr
;
96 extern u_short daemon_port
;
101 #define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str)
103 #define p_error(str) warn(str)
106 void ctl_transact(struct in_addr
, CTL_MSG
, int, CTL_RESPONSE
*);