-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCALLDBD.C
115 lines (101 loc) · 2.32 KB
/
CALLDBD.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* Callbook server */
#include "global.h"
#if defined CALLSERVER || defined SAMCALLB || defined QRZCALLB || defined BUCKTSR
#include "files.h"
#include "mbuf.h"
#include "socket.h"
#include "session.h"
#include "proc.h"
#include "dirutil.h"
#include "commands.h"
#include "mailbox.h"
#include "config.h"
extern char *Callserver; /* buckbook.c */
static void calldbd __ARGS((int s,void *unused,void *p));
#if defined(SAMCALLB) || defined(QRZCALLB)
int cb_lookup __ARGS((int s,char *call,FILE *fp));
#else
int cb_lookup(int s,char *call); /* in buckbook.c */
#endif
/* Start up callsign database service */
int
cdbstart(argc,argv,p)
int argc;
char *argv[];
void *p;
{
int16 port;
if(argc < 2)
port = IPPORT_CALLDB;
else
port = atoi(argv[1]);
return start_tcp(port,"CALL Server",calldbd,1024);
}
int
cdb0(argc,argv,p)
int argc;
char *argv[];
void *p;
{
int16 port;
if(argc < 2)
port = IPPORT_CALLDB;
else
port = atoi(argv[1]);
return stop_tcp(port);
}
static void
calldbd(s,unused,p)
int s;
void *unused;
void *p;
{
char user[80];
int err;
sockmode(s,SOCK_ASCII);
sockowner(s,Curproc);
recvline(s,user,80);
rip(user);
log(s,"Callbook lookup: %s",user);
if(strlen(user) == 0)
{
usputs(s,"No Callbook information available\n");
}
else
{
#if defined(SAMCALLB) || defined(QRZCALLB)
if ((err = cb_lookup(s,user,(FILE *) 0)) != 0)
usprintf(s,(err == 2) ? "No Callbook information available\n" : "Callbook not active\n");
#else
cb_lookup(s,user);
#endif
}
close_s(s);
/* log(s,"close Callbook"); */
}
/* This routine has been expanded upon, and is now located in buckbook.c
- kb7yw Mon 01-27-1992
int
docallserver(argc,argv,p)
int argc;
char *argv[];
void *p;
{
if(argc < 2)
{
if(Callserver != NULLCHAR)
tprintf("The callserver's host name is: %s\n",Callserver);
else
{
tputs("Callserver not configured!\nUsage: callserver hostname OR callserver ip_address\n");
}
}
else {
if(Callserver != NULLCHAR)
free(Callserver);
Callserver = strdup(argv[1]);
}
return 0;
}
*/
#endif /* CALLSERVER */