Begin transition to interface with vgetty
This commit is contained in:
parent
e5f79de09a
commit
4acfc6f0b2
@ -3,7 +3,7 @@
|
||||
* (C)2005, Dan Ponte
|
||||
* BSDL w/ advert.
|
||||
*/
|
||||
/* $Amigan: phoned/include/phoned.h,v 1.29 2005/06/28 02:32:52 dcp1990 Exp $ */
|
||||
/* $Amigan: phoned/include/phoned.h,v 1.30 2010/02/13 19:02:57 dcp1990 Exp $ */
|
||||
#include <pcre.h> /* fugly, I know... */
|
||||
#define VERSION "0.1"
|
||||
#define LOGFILE "-"
|
||||
@ -18,6 +18,7 @@ struct conf {
|
||||
int loglevels;
|
||||
short modem_tm;
|
||||
char* modemdev;
|
||||
int modemhand;
|
||||
char *dbfile;
|
||||
};
|
||||
#define LL_DEBUG 0x1
|
||||
|
@ -1,9 +1,9 @@
|
||||
# cnd Makefile
|
||||
# (C)2005, Dan Ponte
|
||||
# $Amigan: phoned/phoned/Makefile,v 1.15 2008/08/07 19:17:23 dcp1990 Exp $
|
||||
# $Amigan: phoned/phoned/Makefile,v 1.16 2010/02/13 19:03:04 dcp1990 Exp $
|
||||
include ../global.mk
|
||||
# basic stuff. we append for a reason.
|
||||
CPPFLAGS+=-I../include -DDEBUG -DYY_NO_UNPUT -DMODDEBUG
|
||||
CPPFLAGS+=-I../include -DDEBUG -DYY_NO_UNPUT -DMODDEBUG -DMODEMSAID
|
||||
CFLAGS+=-g -Wall -W -ansi ${CPPFLAGS} -pthread
|
||||
LDFLAGS+=-lutil -lpcre -lsqlite3
|
||||
# keep these up to date.
|
||||
|
@ -39,6 +39,9 @@ hangup yylval.number = CTACT_HUP; return ACTN;
|
||||
ignore yylval.number = CTACT_IGN; return ACTN;
|
||||
play yylval.number = CTACT_PLAY; return ACTN;
|
||||
record yylval.number = CTACT_REC; return ACTN;
|
||||
enabled yylval.number = 1; return ENA_DIS_STATE;
|
||||
disabled yylval.number = 0; return ENA_DIS_STATE;
|
||||
modemhandler return MODHAND;
|
||||
modemdev return MODDEV;
|
||||
\| return OR;
|
||||
\" return QUOTE;
|
||||
|
@ -33,10 +33,10 @@ int yywrap(void)
|
||||
return 1;
|
||||
}
|
||||
%}
|
||||
%token NOTIFY OBRACE CBRACE SCOLON QUOTE MODDEV MAIN LLEVEL OR
|
||||
%token NOTIFY OBRACE CBRACE SCOLON QUOTE MODDEV MAIN LLEVEL OR MODHAND
|
||||
%token FILTERS ACTION NAME PHNUM FILTER FLAGS DB SOCK
|
||||
/* HANGUP IGNOREIT PLAY RECORD */
|
||||
%token <number> LNUML ACTN FLAG
|
||||
%token <number> LNUML ACTN FLAG ENA_DIS_STATE
|
||||
%token <string> IPADDR PATH REGEX FNAME
|
||||
%%
|
||||
commands:
|
||||
@ -68,6 +68,8 @@ directive:
|
||||
database
|
||||
|
|
||||
socket
|
||||
|
|
||||
modhand
|
||||
;
|
||||
notify:
|
||||
NOTIFY iplist
|
||||
@ -113,6 +115,15 @@ dbpath:
|
||||
modemdev:
|
||||
MODDEV devpath
|
||||
;
|
||||
modhand:
|
||||
MODHAND ENA_DIS_STATE
|
||||
{
|
||||
pthread_mutex_lock(&cfmx);
|
||||
cf.modemhand = $2;
|
||||
pthread_mutex_unlock(&cfmx);
|
||||
lprintf(debug, "Modem handler %s\n", yylval.number ? "enabled" : "disabled");
|
||||
}
|
||||
;
|
||||
devpath:
|
||||
QUOTE PATH QUOTE
|
||||
{
|
||||
|
@ -76,11 +76,13 @@ void initialize(void)
|
||||
exit(-1);
|
||||
} else whatdone |= WD_CONFIG; /* XXX: if you put anything before this, edit config.y's bitmask on shutd() */
|
||||
pthread_mutex_lock(&cfmx);
|
||||
if(cf.modemhand) {
|
||||
if(init_modem(cf.modemdev) != 1) {
|
||||
lprintf(fatal, "fatal error: modem didn't initialise properly; see previous messages\n");
|
||||
shutd(whatdone);
|
||||
exit(-1);
|
||||
} else whatdone |= WD_MODEM;
|
||||
}
|
||||
if(!db_init(cf.dbfile)) {
|
||||
lprintf(fatal, "fatal error: database did not open, see previous messages\n");
|
||||
shutd(whatdone);
|
||||
|
@ -65,13 +65,18 @@ int main(argc, argv)
|
||||
}
|
||||
cf.modem_tm = 0;
|
||||
cf.loglevels = LL_ALL;
|
||||
cf.modemhand = 1;
|
||||
pthread_mutex_unlock(&cfmx);
|
||||
initialize();
|
||||
lprintf(debug, "INIT IS 0x%x", PTHREAD_MUTEX_INITIALIZER);
|
||||
pthread_create(&networkth, NULL, network, NULL);
|
||||
lprintf(debug, "Started network with 0x%x.", networkth);
|
||||
pthread_mutex_lock(&cfmx);
|
||||
if(cf.modemhand) {
|
||||
pthread_create(&modemth, NULL, modem_io, NULL);
|
||||
lprintf(debug, "Started modemth with 0x%x.", modemth);
|
||||
}
|
||||
pthread_mutex_unlock(&cfmx);
|
||||
pthread_create(&mainth, NULL, mainthf, NULL);
|
||||
pthread_exit(NULL);
|
||||
return 0;
|
||||
|
@ -69,6 +69,7 @@ int modempipes[2];
|
||||
extern pthread_mutex_t cfmx;
|
||||
modem_t* mo;
|
||||
extern modem_t rockwell;
|
||||
extern modem_t agere;
|
||||
void stmod(str)
|
||||
const char* str;
|
||||
{
|
||||
@ -237,7 +238,7 @@ int init_modem(char* dev)
|
||||
return -3;
|
||||
}
|
||||
fcntl(modemfd, F_SETFL, O_NONBLOCK);
|
||||
mo = &rockwell;
|
||||
mo = &agere;
|
||||
mo->init();
|
||||
/* voice_init(); */
|
||||
pthread_mutex_unlock(&modemmx);
|
||||
|
@ -1,6 +1,6 @@
|
||||
# cnd Makefile
|
||||
# (C)2005, Dan Ponte
|
||||
# $Amigan: phoned/phoned/modems/Makefile,v 1.2 2005/06/18 20:26:14 dcp1990 Exp $
|
||||
# $Amigan: phoned/phoned/modems/Makefile,v 1.3 2010/02/13 19:03:10 dcp1990 Exp $
|
||||
include ../../global.mk
|
||||
# basic stuff. we append for a reason.
|
||||
CPPFLAGS+=-I../../include
|
||||
@ -8,8 +8,8 @@ CFLAGS+=-g -Wall -W -ansi ${CPPFLAGS}
|
||||
LDFLAGS=
|
||||
# keep these up to date.
|
||||
MAINBIN=libmodems.a
|
||||
SRCS=rockwell.c
|
||||
OBJS=rockwell.o
|
||||
SRCS=rockwell.c agere.c
|
||||
OBJS=rockwell.o agere.o
|
||||
all: .depend ${MAINBIN}
|
||||
# I know, I know, but it's good.
|
||||
.depend: ${SRCS} ${OHDRS}
|
||||
|
@ -1,8 +1,9 @@
|
||||
main {
|
||||
modemdev "/dev/cuad0";
|
||||
modemdev "/dev/cuau1";
|
||||
loglevel all;
|
||||
database "./phoned.db";
|
||||
socket "/tmp/phoned.sock";
|
||||
modemhandler disabled;
|
||||
};
|
||||
filters {
|
||||
filter test1 {
|
||||
|
Loading…
Reference in New Issue
Block a user