|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)talk_ctl.h 5.2 (Berkeley) 3/13/86
7: */
8:
9: #include <sys/types.h>
10: #include <netinet/in.h>
11:
12: #ifdef TALK_43
13: #include <protocols/talkd.h>
14: #else
15: #include <sys/socket.h>
16:
17: #define NAME_SIZE 9
18: #define TTY_SIZE 16
19: #ifndef MAXHOSTNAMELEN
20: #define MAXHOSTNAMELEN 256
21: #endif
22:
23: #define MAX_LIFE 60 /* max time daemon saves invitations */
24: /* RING_WAIT should be 10's of seconds less than MAX_LIFE */
25: #define RING_WAIT 30 /* time to wait before refreshing invitation */
26:
27: /* type values */
28: #define LEAVE_INVITE 0
29: #define LOOK_UP 1
30: #define DELETE 2
31: #define ANNOUNCE 3
32:
33: /* answer values */
34: #define SUCCESS 0
35: #define NOT_HERE 1
36: #define FAILED 2
37: #define MACHINE_UNKNOWN 3
38: #define PERMISSION_DENIED 4
39: #define UNKNOWN_REQUEST 5
40:
41: typedef struct ctl_response {
42: char type;
43: char answer;
44: int id_num;
45: struct sockaddr_in addr;
46: } CTL_RESPONSE;
47:
48: typedef struct ctl_msg {
49: char type;
50: char l_name[NAME_SIZE];
51: char r_name[NAME_SIZE];
52: int id_num;
53: int pid;
54: char r_tty[TTY_SIZE];
55: struct sockaddr_in addr;
56: struct sockaddr_in ctl_addr;
57: } CTL_MSG;
58: #endif
59:
60: #include <errno.h>
61: #ifdef LOG
62: #include <syslog.h>
63: #endif
64:
65: extern int errno;
66:
67: extern struct sockaddr_in daemon_addr;
68: extern struct sockaddr_in ctl_addr;
69: extern struct sockaddr_in my_addr;
70: extern struct in_addr my_machine_addr;
71: extern struct in_addr his_machine_addr;
72: extern u_short daemon_port;
73: extern int ctl_sockt;
74: extern CTL_MSG msg;
75:
76: #ifdef LOG
77: #define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str)
78: #else LOG
79: #define p_error(str) perror(str)
80: #endif LOG
81:
82: # ifndef htons
83: extern unsigned short htons(), ntohs();
84: # endif
85: # ifndef htonl
86: extern unsigned long htonl(), ntohl();
87: # endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.