Fresco/Prague/include/Prague/Network echo.hh,1.4,1.5 ftp.hh,1.6,1.7 protocol.hh,1.4,1.5 smtp.hh,1.5,1.6 url.hh,1.4,1.5
Tobias Hunger <[email protected]> Fri, 31 Oct 2003 22:33:43 +0000
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Prague/include/Prague/Network In directory purcel:/tmp/cvs-serv28781/Prague/include/Prague/Network Modified Files: echo.hh ftp.hh protocol.hh smtp.hh url.hh Log Message: Fix up indention according to the coding style guide. Index: echo.hh =================================================================== RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Network/echo.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- echo.hh 25 Mar 2001 08:25:16 -0000 1.4 +++ echo.hh 31 Oct 2003 22:33:10 -0000 1.5 @@ -1,9 +1,9 @@ /*$Id$ * - * This source file is a part of the Berlin Project. + * This source file is a part of the Fresco Project. * Copyright (C) 1992-1996 Gnanasekaran Swaminathan <[email protected]> - * Copyright (C) 1999 Stefan Seefeld <[email protected]> - * http://www.berlin-consortium.org + * Copyright (C) 1999 Stefan Seefeld <[email protected]> + * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,27 +29,36 @@ namespace Prague { -class echo: public protocol -{ -public: - class echobuf: public protocol::protocolbuf + class echo: public protocol { - public: -// echobuf (sockinetbuf &si): protocol::protocolbuf(si) {} - echobuf (protocol::p_name pname) : protocol::protocolbuf (pname) {} - virtual void serve_clients(int portno = -1); - virtual const char *rfc_name() const { return "echo";} - virtual const char *rfc_doc() const { return "rfc862";} + public: + class echobuf: public protocol::protocolbuf + { + public: + // echobuf (sockinetbuf &si) : + // protocol::protocolbuf(si) + // { } + echobuf (protocol::p_name pname) : + protocol::protocolbuf (pname) + { } + virtual void serve_clients(int portno = -1); + virtual const char *rfc_name() const { return "echo";} + virtual const char *rfc_doc() const { return "rfc862";} + }; + // protected: + // echo (): ios(0) { } + public: + echo(protocol::p_name pname) : + protocol(new echobuf(pname)) + { } + ~echo() { delete protocol::rdbuf(); } + echobuf *rdbuf() + { + return static_cast<echobuf *>(protocol::rdbuf()); + } + echobuf *operator ->() { return rdbuf(); } }; -// protected: -// echo (): ios(0) {} -public: - echo(protocol::p_name pname) : protocol(new echobuf(pname)) {} - ~echo() { delete protocol::rdbuf();} - echobuf *rdbuf() { return static_cast<echobuf *>(protocol::rdbuf());} - echobuf *operator ->() { return rdbuf();} -}; -}; +} // namespace #endif Index: ftp.hh =================================================================== RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Network/ftp.hh,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ftp.hh 18 Apr 2001 06:07:26 -0000 1.6 +++ ftp.hh 31 Oct 2003 22:33:10 -0000 1.7 @@ -1,9 +1,9 @@ /*$Id$ * - * This source file is a part of the Berlin Project. + * This source file is a part of the Fresco Project. * Copyright (C) 1992-1996 Gnanasekaran Swaminathan <[email protected]> - * Copyright (C) 1999 Stefan Seefeld <[email protected]> - * http://www.berlin-consortium.org + * Copyright (C) 1999 Stefan Seefeld <[email protected]> + * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,116 +30,119 @@ namespace Prague { -class ftp : public protocol -{ -public: - enum reptype - { - rt_ascii_nonprint, - rt_ascii_telnet, - rt_ascii_asa, - rt_ebcdic_nonprint, - rt_ebcdic_telnet, - rt_ebcdic_asa, - rt_image, - rt_local - }; - enum filestru - { - fs_file, - fs_record, - fs_page - }; - enum transmode - { - tm_stream, - tm_block, - tm_comp - }; - enum replycodea + class ftp : public protocol { - rca_posprelim = '1', - rca_poscomp = '2', - rca_posinter = '3', - rca_error = '4', - rca_negtranscomp = '4', - rca_negpermcomp = '5' - }; + public: + enum reptype + { + rt_ascii_nonprint, + rt_ascii_telnet, + rt_ascii_asa, + rt_ebcdic_nonprint, + rt_ebcdic_telnet, + rt_ebcdic_asa, + rt_image, + rt_local + }; + enum filestru + { + fs_file, + fs_record, + fs_page + }; + enum transmode + { + tm_stream, + tm_block, + tm_comp + }; + enum replycodea + { + rca_posprelim = '1', + rca_poscomp = '2', + rca_posinter = '3', + rca_error = '4', + rca_negtranscomp = '4', + rca_negpermcomp = '5' + }; - enum replycodeb - { - rcb_syntax = '0', - rcb_info = '1', - rcb_conn = '2', - rcb_auth = '3', - rcb_unspec = '4', - rcb_filesys = '5' - }; + enum replycodeb + { + rcb_syntax = '0', + rcb_info = '1', + rcb_conn = '2', + rcb_auth = '3', + rcb_unspec = '4', + rcb_filesys = '5' + }; - class ftpbuf : public protocol::protocolbuf - { - public: - ftpbuf(std::ostream *out = 0); - ftp::replycodea get_response(); - const char *reply_code() const { return _replycode;} - ftp::replycodea help() { return send_cmd("HELP");} - ftp::replycodea noop() { return send_cmd("NOOP");} - ftp::replycodea quit() { return send_cmd("QUIT");} - ftp::replycodea abort() { return send_cmd("ABOR");} - ftp::replycodea user(const char* name) {return send_cmd("USER", name);} - ftp::replycodea passwd(const char* pw) {return send_cmd("PASS", pw);} - ftp::replycodea acct(const char* ac) {return send_cmd("ACCT", ac);} - ftp::replycodea cd(const char* dir); - ftp::replycodea useraddr(const sockinetaddr &sa); - ftp::replycodea useraddr(const char *host, int portno); - ftp::replycodea server_port(int portno); - ftp::replycodea rep_type(ftp::reptype rt); - ftp::replycodea file_stru(ftp::filestru fs); - ftp::replycodea trans_mode(ftp::transmode tm); - // service commands - ftp::replycodea getfile(const char *rpath, const char *lpath); - ftp::replycodea list(const char *lpath = 0, bool justnames = false); - ftp::replycodea putfile(const char *lpath, const char *rpath); - ftp::replycodea putfile(const char *lpath); - ftp::replycodea append(const char *lpath, const char *rpath); - ftp::replycodea allocate(int numbytes); - ftp::replycodea restart(int marker); - ftp::replycodea rename(const char *rpath, const char *newrpath); - ftp::replycodea rmfile(const char *rpath); - ftp::replycodea rmdir(const char *rpath); - ftp::replycodea mkdir(const char *rpath); - ftp::replycodea pwd() { return send_cmd ("PWD");} - ftp::replycodea system() { return send_cmd ("SYST");} - ftp::replycodea status() { return send_cmd ("STAT");} - virtual void serve_clients(int portno = -1); - virtual const char *rfc_name() const { return "ftp";} - virtual const char *rfc_doc() const { return "rfc959";} - private: - ftp::replycodea send_cmd(const char *cmd, const char *arg = 0); - ftp::replycodea ftpdata(int portno, std::istream *in, std::ostream *out, - const char *cmd, const char *arg = 0); - ftpbuf (ftpbuf &); - ftpbuf &operator = (ftpbuf &); - // the following are used when this is used as a server - char *_usr; - char* _password; - char* _account; - char _cwd[MAXPATHLEN]; - char _parentdir[MAXPATHLEN]; - ftp::filestru _fs; - ftp::transmode _tm; - sockinetaddr _udata; // user will listen at this addr for data conn. - int _serverportno; - char _replycode[5]; - std::ostream *_os; + class ftpbuf : public protocol::protocolbuf + { + public: + ftpbuf(std::ostream *out = 0); + ftp::replycodea get_response(); + const char *reply_code() const { return _replycode; } + ftp::replycodea help() { return send_cmd("HELP"); } + ftp::replycodea noop() { return send_cmd("NOOP"); } + ftp::replycodea quit() { return send_cmd("QUIT"); } + ftp::replycodea abort() { return send_cmd("ABOR"); } + ftp::replycodea user(const char* name) + { return send_cmd("USER", name); } + ftp::replycodea passwd(const char* pw) + {return send_cmd("PASS", pw); } + ftp::replycodea acct(const char* ac) + {return send_cmd("ACCT", ac); } + ftp::replycodea cd(const char* dir); + ftp::replycodea useraddr(const sockinetaddr &sa); + ftp::replycodea useraddr(const char *host, int portno); + ftp::replycodea server_port(int portno); + ftp::replycodea rep_type(ftp::reptype rt); + ftp::replycodea file_stru(ftp::filestru fs); + ftp::replycodea trans_mode(ftp::transmode tm); + // service commands + ftp::replycodea getfile(const char *rpath, const char *lpath); + ftp::replycodea list(const char *lpath = 0, bool justnames = false); + ftp::replycodea putfile(const char *lpath, const char *rpath); + ftp::replycodea putfile(const char *lpath); + ftp::replycodea append(const char *lpath, const char *rpath); + ftp::replycodea allocate(int numbytes); + ftp::replycodea restart(int marker); + ftp::replycodea rename(const char *rpath, const char *newrpath); + ftp::replycodea rmfile(const char *rpath); + ftp::replycodea rmdir(const char *rpath); + ftp::replycodea mkdir(const char *rpath); + ftp::replycodea pwd() { return send_cmd ("PWD");} + ftp::replycodea system() { return send_cmd ("SYST");} + ftp::replycodea status() { return send_cmd ("STAT");} + virtual void serve_clients(int portno = -1); + virtual const char *rfc_name() const { return "ftp"; } + virtual const char *rfc_doc() const { return "rfc959"; } + private: + ftp::replycodea send_cmd(const char *cmd, const char *arg = 0); + ftp::replycodea ftpdata(int portno, std::istream *in, std::ostream *out, + const char *cmd, const char *arg = 0); + ftpbuf (ftpbuf &); + ftpbuf &operator = (ftpbuf &); + // the following are used when this is used as a server + char *_usr; + char* _password; + char* _account; + char _cwd[MAXPATHLEN]; + char _parentdir[MAXPATHLEN]; + ftp::filestru _fs; + ftp::transmode _tm; + sockinetaddr _udata; // user will listen at this addr for data conn. + int _serverportno; + char _replycode[5]; + std::ostream *_os; + }; + public: + ftp(std::ostream *out) : protocol(new ftpbuf(out)) { } + ~ftp() { delete protocol::rdbuf(); init(0); } + ftpbuf *rdbuf() { return static_cast<ftpbuf *>(protocol::rdbuf()); } + ftpbuf *operator ->() { return rdbuf(); } }; -public: - ftp(std::ostream *out) : protocol(new ftpbuf(out)) {} - ~ftp() { delete protocol::rdbuf(); init(0);} - ftpbuf *rdbuf() { return static_cast<ftpbuf *>(protocol::rdbuf());} - ftpbuf *operator ->() { return rdbuf();} -}; -}; - +} // namespace + #endif /* _ftp_hh */ Index: protocol.hh =================================================================== RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Network/protocol.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- protocol.hh 25 Mar 2001 08:25:16 -0000 1.4 +++ protocol.hh 31 Oct 2003 22:33:10 -0000 1.5 @@ -1,9 +1,9 @@ /*$Id$ * - * This source file is a part of the Berlin Project. + * This source file is a part of the Fresco Project. * Copyright (C) 1992-1996 Gnanasekaran Swaminathan <[email protected]> - * Copyright (C) 1999 Stefan Seefeld <[email protected]> - * http://www.berlin-consortium.org + * Copyright (C) 1999 Stefan Seefeld <[email protected]> + * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,41 +29,46 @@ namespace Prague { -class protocol: public iosockstream -{ -public: - enum p_name + class protocol: public iosockstream { - nil = 0, - tcp = sockbuf::sock_stream, - udp = sockbuf::sock_dgram - }; + public: + enum p_name + { + nil = 0, + tcp = sockbuf::sock_stream, + udp = sockbuf::sock_dgram + }; - class protocolbuf: public sockinetbuf - { - public: -// protocolbuf(sockinetbuf &si): sockinetbuf (si), pn (protocol::nil) {} - protocolbuf(protocol::p_name pname) - : sockinetbuf((sockbuf::type) pname, 0), pn (pname) {} + class protocolbuf: public sockinetbuf + { + public: + // protocolbuf(sockinetbuf &si): + // sockinetbuf (si), + // pn(protocol::nil) + // { } + protocolbuf(protocol::p_name pname) : + sockinetbuf((sockbuf::type) pname, 0), + pn(pname) + { } - void bind() { serve_clients();} - void connect(); - void connect(unsigned long addr); - void connect(const std::string &); - void connect(const std::string &, int); + void bind() { serve_clients(); } + void connect(); + void connect(unsigned long addr); + void connect(const std::string &); + void connect(const std::string &, int); - const char *protocol_name() const; - virtual void serve_clients(int portno = -1) = 0; - virtual const char *rfc_name() const = 0; - virtual const char *rfc_doc() const = 0; - private: - protocol::p_name pn; - void bind (sockinetaddr &sa) { sockinetbuf::bind(sa);} - void connect (sockinetaddr &sa) { sockinetbuf::connect(sa);} + const char *protocol_name() const; + virtual void serve_clients(int portno = -1) = 0; + virtual const char *rfc_name() const = 0; + virtual const char *rfc_doc() const = 0; + private: + protocol::p_name pn; + void bind (sockinetaddr &sa) { sockinetbuf::bind(sa); } + void connect (sockinetaddr &sa) { sockinetbuf::connect(sa); } + }; + protocol (sockbuf *sbuf) : iosockstream(sbuf) { } }; - protocol (sockbuf *sbuf) : iosockstream(sbuf) {} -}; -}; +} // namespace #endif Index: smtp.hh =================================================================== RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Network/smtp.hh,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- smtp.hh 25 Mar 2001 08:25:16 -0000 1.5 +++ smtp.hh 31 Oct 2003 22:33:10 -0000 1.6 @@ -1,9 +1,9 @@ /*$Id$ * - * This source file is a part of the Berlin Project. + * This source file is a part of the Fresco Project. * Copyright (C) 1992-1996 Gnanasekaran Swaminathan <[email protected]> - * Copyright (C) 1999 Stefan Seefeld <[email protected]> - * http://www.berlin-consortium.org + * Copyright (C) 1999 Stefan Seefeld <[email protected]> + * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,50 +29,56 @@ namespace Prague { -class smtp: public protocol -{ -public: - class smtpbuf : public protocol::protocolbuf + class smtp: public protocol { - public: - smtpbuf(std::ostream *os = 0) : protocol::protocolbuf (protocol::tcp), _os(os) {} - void send_buf(const char *buf, int buflen); + public: + class smtpbuf : public protocol::protocolbuf + { + public: + smtpbuf(std::ostream *os = 0) : + protocol::protocolbuf (protocol::tcp), + _os(os) + { } + void send_buf(const char *buf, int buflen); - void helo(); - void quit() { send_cmd("QUIT");} - void turn() { send_cmd("TURN");} - void rset() { send_cmd("RSET");} - void noop() { send_cmd("NOOP");} - void vrfy(const std::string &s) { send_cmd("VRFY ", s);} - void expn(const std::string &s) { send_cmd("EXPN ", s);} + void helo(); + void quit() { send_cmd("QUIT"); } + void turn() { send_cmd("TURN"); } + void rset() { send_cmd("RSET"); } + void noop() { send_cmd("NOOP"); } + void vrfy(const std::string &s) { send_cmd("VRFY ", s); } + void expn(const std::string &s) { send_cmd("EXPN ", s); } - void data() { send_cmd("DATA");} - void data(const char *buf, int buflen); - void data(const std::string &filename); // filename = 0 => stdin + void data() { send_cmd("DATA"); } + void data(const char *buf, int buflen); + void data(const std::string &filename); // filename = 0 => stdin - void mail(const std::string &from); - void rcpt(const std::string &to); - void help(const std::string &s = ""); + void mail(const std::string &from); + void rcpt(const std::string &to); + void help(const std::string &s = ""); - virtual void serve_clients(int portno = -1); - virtual const char *rfc_name() const { return "smtp";} - virtual const char *rfc_doc() const { return "rfc821";} - private: - std::ostream *_os; // send all the responses to os - void send_cmd(const std::string &cmd, const std::string &s = "", const std::string &p = ""); - void get_response(); - // smtpbuf(smtpbuf &); - // smtpbuf& operator = (smtpbuf &); + virtual void serve_clients(int portno = -1); + virtual const char *rfc_name() const { return "smtp"; } + virtual const char *rfc_doc() const { return "rfc821"; } + private: + std::ostream *_os; // send all the responses to os + void send_cmd(const std::string &cmd, + const std::string &s = "", + const std::string &p = ""); + void get_response(); + // smtpbuf(smtpbuf &); + // smtpbuf& operator = (smtpbuf &); + }; + public: + smtp(std::ostream *out): protocol(new smtpbuf(out)) { } + ~smtp() { delete protocol::rdbuf(); init(0); } + int get_response (char *buf, int len); + smtpbuf *rdbuf() + { return static_cast<smtpbuf *>(protocol::rdbuf()); } + smtpbuf *operator ->() { return rdbuf(); } }; -public: - smtp(std::ostream *out): protocol(new smtpbuf(out)) {} - ~smtp() { delete protocol::rdbuf(); init(0);} - int get_response (char *buf, int len); - smtpbuf *rdbuf() { return static_cast<smtpbuf *>(protocol::rdbuf());} - smtpbuf *operator ->() { return rdbuf();} -}; -}; +} // namespace extern std::ostream &operator << (std::ostream &, Prague::smtp &); Index: url.hh =================================================================== RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Network/url.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- url.hh 25 Mar 2001 08:25:16 -0000 1.4 +++ url.hh 31 Oct 2003 22:33:10 -0000 1.5 @@ -1,8 +1,8 @@ /*$Id$ * - * This source file is a part of the Berlin Project. - * Copyright (C) 1999 Stefan Seefeld <[email protected]> - * http://www.berlin-consortium.org + * This source file is a part of the Fresco Project. + * Copyright (C) 1999 Stefan Seefeld <[email protected]> + * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,38 +27,38 @@ namespace Prague { -class url -{ -public: - url(const std::string &); - url(const url &, const std::string &); -// operator const std::string &() const; - const std::string &scheme() const { return s;} - const std::string &user() const { return u;} - const std::string &password() const { return pw;} - const std::string &hostname() const { return h;} - const std::string &path() const { return p;} - void setPath(const char *pp) { p = pp;} - const std::string &fragment() const { return f;} - const std::string &query() const { return q;} - void setQuery(const std::string &qq) { q = qq;} - const std::string ¶meters() const { return pa;} - int port() const { return po;} - static void encode(std::string &); - static void decode(std::string &); -private: - void parse(const std::string &); - std::string s; - std::string u; - std::string pw; - std::string h; - std::string p; - std::string f; - std::string q; - std::string pa; - int po; -}; + class url + { + public: + url(const std::string &); + url(const url &, const std::string &); + // operator const std::string &() const; + const std::string &scheme() const { return s; } + const std::string &user() const { return u; } + const std::string &password() const { return pw; } + const std::string &hostname() const { return h; } + const std::string &path() const { return p; } + void setPath(const char *pp) { p = pp; } + const std::string &fragment() const { return f; } + const std::string &query() const { return q; } + void setQuery(const std::string &qq) { q = qq; } + const std::string ¶meters() const { return pa; } + int port() const { return po; } + static void encode(std::string &); + static void decode(std::string &); + private: + void parse(const std::string &); + std::string s; + std::string u; + std::string pw; + std::string h; + std::string p; + std::string f; + std::string q; + std::string pa; + int po; + }; -}; +} // namespace #endif /* _url_hh */