Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
4e13f778
Commit
4e13f778
authored
Feb 20, 2013
by
Jeroen Vreeken
Browse files
make console runable
parent
e4491c73
Changes
8
Hide whitespace changes
Inline
Side-by-side
console/console/Makefile
View file @
4e13f778
...
...
@@ -132,6 +132,7 @@ clean:
log_proxy
\
spg_auth
\
spg_log_parser
\
shell.cgi
\
await_controller
\
command.cgi
\
status.cgi
...
...
@@ -139,3 +140,6 @@ clean:
$(MAKE)
-C
doc clean
$(MAKE)
-C
predictlib clean
console/console/await_controller.c
View file @
4e13f778
...
...
@@ -24,6 +24,7 @@
#include
"tcp_connect.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
#define MAX_RETRIES 30
#define SLEEP_INTERVAL 10
...
...
@@ -37,14 +38,14 @@ int fd;
int
retries
=
0
;
if
(
argc
!=
2
)
{
printf
(
"Usage: %s
[host]
\n
"
,
argv
[
0
]);
if
(
argc
!=
1
)
{
printf
(
"Usage: %s
\n
"
,
argv
[
0
]);
printf
(
"
\n
"
);
printf
(
"e.g. %s
foo
\n
"
,
argv
[
0
]);
printf
(
"e.g. %s
\n
"
,
argv
[
0
]);
return
1
;
}
tr_host
=
argv
[
1
]
;
tr_host
=
dt_host_controller
()
;
tr_port
=
CTRL_TRACE_PORT
;
fd
=
tcp_connect
(
tr_host
,
tr_port
);
...
...
console/console/console_httpline.c
deleted
100644 → 0
View file @
e4491c73
/*
HTTP frontend for J2000.0 positions
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2009
Copyright Stichting C.A. Muller Radioastronomiestation, 2009
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<string.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<math.h>
#include
<fcntl.h>
#include
<sys/ioctl.h>
#include
"tcp_connect.h"
int
main
(
int
argc
,
char
**
argv
)
{
int
fd
;
alarm
(
10
);
if
(
argc
!=
3
)
{
printf
(
"Content-type: text/plain
\n
"
);
printf
(
"Cache-Control: no-cache
\n
"
);
printf
(
"Pragma: no-cache
\n
"
);
printf
(
"
\n
"
);
sleep
(
1
);
printf
(
"Not enough arguments
\n
"
);
printf
(
"%s <host> <port>
\n
"
,
argv
[
0
]);
printf
(
"port: e.g. 11030
\n
"
);
return
1
;
}
fd
=
tcp_connect
(
argv
[
1
],
atoi
(
argv
[
2
]));
if
(
fd
>=
0
)
{
char
linebuf
[
1000
];
int
r
;
ioctl
(
fd
,
FIONBIO
,
&
(
int
){
0
});
r
=
read
(
fd
,
linebuf
,
999
);
if
(
r
>
0
)
{
linebuf
[
r
]
=
0
;
printf
(
"Content-type: text/plain
\n
"
);
printf
(
"Content-Length: %d
\n
"
,
r
);
printf
(
"Cache-Control: no-cache
\n
"
);
printf
(
"Pragma: no-cache
\n
"
);
printf
(
"
\n
"
);
printf
(
"%s"
,
linebuf
);
}
}
else
{
printf
(
"Content-type: text/plain
\n
"
);
printf
(
"Content-Length: 7
\n
"
);
printf
(
"Cache-Control: no-cache
\n
"
);
printf
(
"Pragma: no-cache
\n
"
);
printf
(
"
\n
"
);
sleep
(
1
);
printf
(
"failed
\n
"
);
}
return
0
;
}
console/console/log_proxy.c
View file @
4e13f778
...
...
@@ -32,6 +32,7 @@
#include
"tcp_connect.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
char
*
logfile
=
"controller.log"
;
...
...
@@ -44,15 +45,15 @@ int main (int argc, char **argv)
int
nr_clients
=
0
;
int
fd_logfile
=
-
1
;
if
(
argc
!=
3
&&
argc
!=
4
)
{
printf
(
"Usage: %s
[host] [port]
<logfile>
\n
"
,
argv
[
0
]);
if
(
argc
!=
1
&&
argc
!=
2
)
{
printf
(
"Usage: %s <logfile>
\n
"
,
argv
[
0
]);
printf
(
"
\n
"
);
printf
(
"e.g.: %s
foo 11200
\n
"
,
argv
[
0
]);
printf
(
"or: %s
foo 11200
/var/log/controller.log
\n
"
,
argv
[
0
]);
printf
(
"e.g.: %s
\n
"
,
argv
[
0
]);
printf
(
"or: %s /var/log/controller.log
\n
"
,
argv
[
0
]);
return
1
;
}
if
(
argc
==
4
)
{
logfile
=
argv
[
3
];
if
(
argc
==
2
)
{
logfile
=
argv
[
1
];
}
fd_listen
=
tcp_listen
(
CONSOLE_LOG_PORT
,
0
,
100
);
...
...
@@ -65,7 +66,7 @@ int main (int argc, char **argv)
ioctl
(
fd_listen
,
FIONBIO
,
&
(
int
){
1
});
fd_log
=
tcp_connect
(
argv
[
1
],
atoi
(
argv
[
2
])
);
fd_log
=
tcp_connect
(
dt_host_controller
(),
CTRL_LOG_PORT
);
f_log
=
fdopen
(
fd_log
,
"r"
);
while
(
1
)
{
...
...
@@ -77,7 +78,7 @@ int main (int argc, char **argv)
while
(
fd_log
<
0
)
{
sleep
(
1
);
printf
(
"Trying to connect to server.
\n
"
);
fd_log
=
tcp_connect
(
argv
[
1
],
atoi
(
argv
[
2
])
);
fd_log
=
tcp_connect
(
dt_host_controller
(),
CTRL_LOG_PORT
);
}
rb
=
sprintf
(
buffer
,
"Established connection to controller
\n
"
);
...
...
console/console/spg_auth.c
View file @
4e13f778
...
...
@@ -41,6 +41,7 @@
#include
"block_setpoint_generator.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
struct
console_client
{
struct
console_client
*
next
;
...
...
@@ -404,7 +405,7 @@ void handle_client(struct spg_client *client, struct spg_client **clientp)
}
if
(
client
->
cmdlen
>=
12
)
{
printf
(
"cmdlen %d is to long
\n
"
,
client
->
cmdlen
);
printf
(
"cmdlen %
z
d is to long
\n
"
,
client
->
cmdlen
);
close
(
client
->
fd
);
client
->
fd
=
-
1
;
return
;
...
...
@@ -595,10 +596,9 @@ int main (int argc, char **argv)
signal
(
SIGPIPE
,
SIG_IGN
);
command_host
=
dt_host_controller
();
if
(
argc
>
1
)
{
command_host
=
argv
[
1
];
}
if
(
argc
>
2
)
{
logfile
=
argv
[
2
];
}
...
...
console/console/start_console.sh
View file @
4e13f778
#!/bin/sh
CTRL
=
127.0.0.1
#await_controller
$CTRL
#await_controller
if
[
$?
-eq
1
]
then
echo
"Start-up niet mogelijk; controller-PC is niet goed opgestart
\n
"
...
...
@@ -10,9 +9,9 @@ then
fi
screen
-dmS
trace_proxy trace_proxy
$CTRL
20000
screen
-dmS
spg_auth spg_auth
$CTRL
screen
-dmS
log_proxy log_proxy
$CTRL
21200
screen
-dmS
trace_proxy trace_proxy
screen
-dmS
spg_auth spg_auth
screen
-dmS
log_proxy log_proxy
sleep
1
screen
-dmS
console_idle console_idle
screen
-dmS
console_j2000tracker console_j2000tracker
...
...
console/console/trace_line.c
deleted
100644 → 0
View file @
e4491c73
/*
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2008, 2009
Copyright Stichting C.A. Muller Radioastronomiestation, 2008, 2009
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<sys/ioctl.h>
#include
<unistd.h>
#include
<errno.h>
#include
<signal.h>
#include
<time.h>
#include
"tcp_connect.h"
char
*
host
=
"localhost"
;
int
port
=
10001
;
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
int
fd
;
int
r
;
char
buf
[
10
];
char
linebuf
[
1000
];
int
linepos
=
0
;
char
*
query
;
fd
=
tcp_connect
(
host
,
port
);
query
=
getenv
(
"QUERY_STRING"
);
for
(
i
=
0
;
i
<
strlen
(
query
);
i
++
)
if
(
query
[
i
]
==
'&'
)
break
;
i
++
;
for
(;
i
<
strlen
(
query
)
+
1
;
i
++
)
if
(
query
[
i
]
==
'&'
)
write
(
fd
,
&
(
char
){
0
},
1
);
else
write
(
fd
,
&
query
[
i
],
1
);
write
(
fd
,
&
(
char
){
0
},
1
);
ioctl
(
fd
,
FIONBIO
,
&
(
int
){
0
});
while
((
r
=
read
(
fd
,
buf
,
1
)
>
0
))
{
linebuf
[
linepos
]
=
buf
[
0
];
linepos
++
;
}
linebuf
[
linepos
]
=
0
;
printf
(
"Content-type: text/plain
\n
"
);
printf
(
"Content-Length: %d
\n
"
,
linepos
);
printf
(
"Cache-Control: no-cache
\n
"
);
printf
(
"Pragma: no-cache
\n
"
);
printf
(
"
\n
"
);
printf
(
"%s"
,
linebuf
);
return
0
;
}
console/console/trace_proxy.c
View file @
4e13f778
...
...
@@ -32,6 +32,7 @@
#include
"tcp_connect.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
#define INBUF_MAX 100
...
...
@@ -464,12 +465,6 @@ int main(int argc, char **argv)
list
[
1
]
=
0
;
listlen
=
2
;
if
(
argc
!=
3
)
{
printf
(
"Usage: %s [host] [port]
\n
"
,
argv
[
0
]);
printf
(
"
\n
"
);
printf
(
"e.g. %s foo 10000
\n
"
,
argv
[
0
]);
return
1
;
}
fd_listen
=
tcp_listen
(
CONSOLE_TRACE_PORT
,
0
,
100
);
if
(
fd_listen
<
0
)
{
...
...
@@ -486,8 +481,8 @@ int main(int argc, char **argv)
signal
(
SIGPIPE
,
SIG_IGN
);
/* determine socket on dt_ctrl */
tr_host
=
argv
[
1
]
;
tr_port
=
atoi
(
argv
[
2
])
;
tr_host
=
dt_host_controller
()
;
tr_port
=
CTRL_TRACE_PORT
;
nonex
=
trace_open
(
"Non-existing-trace"
);
if
(
nonex
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment