class TCPsocket {
public:
TCPsocket::TCPsocket(void);
- int attach(char *, char *);
+ int attach(const char *, const char *);
void detach(void);
void serv_read(char *, int);
void serv_write(char *, int);
void serv_gets(char *);
- void serv_puts(char *);
+ void serv_puts(const char *);
bool is_connected(void);
private:
int serv_sock;
- int connectsock(char *, char *, char *);
- void timeout(int);
+ int connectsock(const char *, const char *, const char *);
+ static void timeout(int);
};
// CitClient represents an application-level connection to a Citadel server.
class CitClient {
+ friend TCPsocket::timeout(int);
public:
CitClient(void);
~CitClient(void);
extern wxMDIParentFrame *BigMDI;
extern RoomTree *RoomList;
+extern CitClient *citadel;
void TCPsocket::timeout(int signum) {
fprintf(stderr, "Connection timed out.\n");
- serv_sock = (-1);
+ citadel->sock.serv_sock = (-1);
}
-int TCPsocket::connectsock(char *host, char *service,
- char *protocol)
+int TCPsocket::connectsock(const char *host, const char *service,
+ const char *protocol)
{
struct hostent *phe;
struct servent *pse;
/*
* send line to server
*/
-void TCPsocket::serv_puts(char *string)
+void TCPsocket::serv_puts(const char *string)
{
char buf[256];
}
-int TCPsocket::attach(char *host, char *port) {
+int TCPsocket::attach(const char *host, const char *port) {
serv_sock = connectsock(host, port, "tcp");
if (serv_sock >= 0) return 0;
else return (-1);