ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/sockunix.C
Revision: 1.1
Committed: Mon Feb 26 15:01:39 2001 UTC (23 years, 9 months ago) by ab11
Content type: text/plain
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Log Message:
Networking class. Assumed to be bug free.

File Contents

# User Rev Content
1 ab11 1.1 // sockunix.C -*- C++ -*- socket library
2     // Copyright (C) 1992,1993,1994 Gnanasekaran Swaminathan <gs4t@virginia.edu>
3     //
4     // Permission is granted to use at your own risk and distribute this software
5     // in source and binary forms provided the above copyright
6     // notice and this paragraph are preserved on all copies.
7     // This software is provided "as is" with no express or implied warranty.
8     //
9     // Version: 17Oct95 1.10
10    
11     #include <sockunix.h>
12     #include <sys/socket.h>
13     #include <string.h>
14    
15     sockunixaddr::sockunixaddr (const char* path)
16     {
17     sun_family = sockunixbuf::af_unix;
18     ::strcpy (sun_path, path);
19     }
20    
21     sockunixaddr::sockunixaddr (const sockunixaddr& suna)
22     {
23     sun_family = sockunixbuf::af_unix;
24     ::strcpy (sun_path, suna.sun_path);
25     }
26    
27     sockunixbuf::sockunixbuf (sockbuf::type ty, int proto)
28     : sockbuf (af_unix, ty, proto)
29     {}
30    
31     sockunixbuf& sockunixbuf::operator = (const sockbuf& su)
32     {
33     this->sockbuf::operator = (su);
34     return *this;
35     }
36    
37     sockunixbuf& sockunixbuf::operator = (const sockunixbuf& su)
38     {
39     this->sockbuf::operator = (su);
40     return *this;
41     }
42    
43     sockbuf* sockunixbuf::open (type st, int proto)
44     {
45     *this = sockunixbuf (st, proto);
46     return this;
47     }
48    
49     int sockunixbuf::bind (sockAddr& sa)
50     {
51     return sockbuf::bind (sa);
52     }
53    
54     int sockunixbuf::bind (const char* path)
55     {
56     sockunixaddr sa (path);
57     return bind (sa);
58     }
59    
60     int sockunixbuf::connect (sockAddr& sa)
61     {
62     return sockbuf::connect (sa);
63     }
64    
65     int sockunixbuf::connect (const char* path)
66     {
67     sockunixaddr sa (path);
68     return connect (sa);
69     }
70    
71     isockunix::isockunix (sockbuf::type ty, int proto)
72     : ios (new sockunixbuf (ty, proto))
73     {}
74    
75     isockunix::isockunix (const sockbuf& sb)
76     : ios (new sockunixbuf (sb))
77     {}
78    
79     isockunix::~isockunix ()
80     {
81     delete ios::rdbuf ();
82     ios::init (0);
83     }
84    
85     osockunix::osockunix (sockbuf::type ty, int proto)
86     : ios (new sockunixbuf (ty, proto))
87     {}
88    
89     osockunix::osockunix (const sockbuf& sb)
90     : ios (new sockunixbuf (sb))
91     {}
92    
93     osockunix::~osockunix ()
94     {
95     delete ios::rdbuf ();
96     ios::init (0);
97     }
98    
99     iosockunix::iosockunix (sockbuf::type ty, int proto)
100     : ios (new sockunixbuf (ty, proto))
101     {}
102    
103     iosockunix::iosockunix (const sockbuf& sb)
104     : ios (new sockunixbuf (sb))
105     {}
106    
107     iosockunix::~iosockunix ()
108     {
109     delete ios::rdbuf ();
110     ios::init (0);
111     }