1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
// sockunix.cpp -*- C++ -*- socket library
// Copyright (C) 2002 Herbert Straub
//
// sockunix.C -*- C++ -*- socket library
// Copyright (C) 1992-1996 Gnanasekaran Swaminathan <gs4t@virginia.edu>
//
// Permission is granted to use at your own risk and distribute this software
// in source and binary forms provided the above copyright notice and this
// paragraph are preserved on all copies. This software is provided "as is"
// with no express or implied warranty.
//
// Version: 12Jan97 1.11
// 2002-07-28 Version 1.2 (C) Herbert Straub
// Eliminating sorry_about_global_temp inititialisation. This don't work
// in combination with NewsCache. My idea is: initializing the classes with (0)
// and in the second step call ios::init (sockinetbuf *) and iosockstream::init ...
// The constructors of isockunix, osockunix and iosockunix are changed.
//#include <windows.h>
//using namespace std;
#include <sockunix.h>
#include <sys/socket.h>
#include <string.h>
sockunixaddr::sockunixaddr (const char* path)
{
sun_family = sockunixbuf::af_unix;
::strcpy (sun_path, path);
}
sockunixaddr::sockunixaddr (const sockunixaddr& suna)
{
sun_family = sockunixbuf::af_unix;
::strcpy (sun_path, suna.sun_path);
}
sockunixbuf::sockunixbuf (const sockbuf::sockdesc& sd)
: sockbuf (sd.sock)
{}
sockunixbuf::sockunixbuf (const sockunixbuf& su)
: sockbuf (su)
{}
sockunixbuf::sockunixbuf (sockbuf::type ty, int proto)
: sockbuf (af_unix, ty, proto)
{}
/*sockunixbuf& sockunixbuf::operator = (const sockunixbuf& su)
{
sockbuf::operator = (su);
return *this;
}*/
void sockunixbuf::bind (sockAddr& sa)
{
sockbuf::bind (sa);
}
void sockunixbuf::bind (const char* path)
{
sockunixaddr sa (path);
bind (sa);
}
void sockunixbuf::connect (sockAddr& sa)
{
sockbuf::connect (sa);
}
void sockunixbuf::connect (const char* path)
{
sockunixaddr sa (path);
connect (sa);
}
isockunix::isockunix (const sockbuf::sockdesc& sd)
: ios (0), isockstream(0)
{
sockunixbuf *t = new sockunixbuf (sd);
ios::init (t);
isockstream::init (t);
}
isockunix::isockunix (sockbuf::type ty, int proto)
: ios (0), isockstream(0)
{
sockunixbuf *t = new sockunixbuf (ty, proto);
ios::init (t);
isockstream::init (t);
}
isockunix::isockunix (const sockunixbuf& sb)
: ios (0), isockstream(0)
{
sockunixbuf *t = new sockunixbuf (sb);
ios::init (t);
isockstream::init (t);
}
isockunix::~isockunix ()
{
delete ios::rdbuf ();
}
osockunix::osockunix (const sockbuf::sockdesc& sd)
: ios (0), osockstream(0)
{
sockunixbuf *t = new sockunixbuf (sd);
ios::init (t);
osockstream::init (t);
}
osockunix::osockunix (sockbuf::type ty, int proto)
: ios (0), osockstream(0)
{
sockunixbuf *t = new sockunixbuf (ty, proto);
ios::init (t);
osockstream::init (t);
}
osockunix::osockunix (const sockunixbuf& sb)
: ios (0), osockstream(0)
{
sockunixbuf *t= new sockunixbuf (sb);
ios::init (t);
osockstream::init (t);
}
osockunix::~osockunix ()
{
delete ios::rdbuf ();
}
iosockunix::iosockunix (const sockbuf::sockdesc& sd)
: ios (0), iosockstream(0)
{
sockunixbuf *t = new sockunixbuf (sd);
ios::init (t);
iosockstream::init (t);
}
iosockunix::iosockunix (sockbuf::type ty, int proto)
: ios (0), iosockstream(0)
{
sockunixbuf *t = new sockunixbuf (ty, proto);
ios::init (t);
iosockstream::init (t);
}
iosockunix::iosockunix (const sockunixbuf& sb)
: ios (0), iosockstream(0)
{
sockunixbuf *t = new sockunixbuf (sb);
ios::init (t);
iosockstream::init (t);
}
iosockunix::~iosockunix ()
{
delete ios::rdbuf ();
}
|