File: sockunix.h

package info (click to toggle)
gdcm 2.4.4-3%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 32,912 kB
  • ctags: 52,166
  • sloc: cpp: 188,527; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (83 lines) | stat: -rw-r--r-- 2,629 bytes parent folder | download | duplicates (11)
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
// sockunix.h -*- 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

#ifndef _SOCKUNIX_H
#define  _SOCKUNIX_H

#include <socket++/sockstream.h>
#include <sys/un.h>

class sockunixaddr: public sockAddr, public sockaddr_un {
public:
                     ~sockunixaddr () {}
           sockunixaddr (const char* path);
           sockunixaddr (const sockunixaddr& suna);
           operator void* () const { return addr_un (); }

  sockaddr_un*       addr_un () const { return (sockaddr_un*)this; }
  int                size () const { return sizeof (sockaddr_un); }
  int                family () const { return sun_family; }
  sockaddr*          addr() const {return (sockaddr*) addr_un (); }
};

class sockunixbuf: public sockbuf {
public:
  enum domain { af_unix = AF_UNIX };

                     sockunixbuf (const sockbuf::sockdesc& sd);
           sockunixbuf (const sockunixbuf& su);
           sockunixbuf (sockbuf::type ty, int proto=0);
//  sockunixbuf&       operator = (const sockunixbuf& su);
                     ~sockunixbuf () {}

  virtual void       bind (sockAddr& sa);
  void               bind (const char* path);

  virtual void       connect (sockAddr& sa);
  void               connect (const char* path);
};

class isockunix: public isockstream
{
public:
           isockunix (const sockbuf::sockdesc& sd);
                     isockunix (const sockunixbuf& sb);
           isockunix (sockbuf::type ty=sockbuf::sock_stream,
        int proto=0);
           ~isockunix();

  sockunixbuf*       operator -> () { return (sockunixbuf*)rdbuf (); }
};

class osockunix: public osockstream
{
public:
           osockunix (const sockbuf::sockdesc& sd);
                     osockunix (const sockunixbuf& sb);
           osockunix (sockbuf::type ty=sockbuf::sock_stream,
        int proto=0);
           ~osockunix ();

  sockunixbuf*       operator -> () { return (sockunixbuf*)rdbuf (); }
};

class iosockunix: public iosockstream
{
public:
           iosockunix (const sockbuf::sockdesc& sd);
                     iosockunix (const sockunixbuf& sb);
           iosockunix (sockbuf::type ty=sockbuf::sock_stream,
         int proto=0);
           ~iosockunix ();

  sockunixbuf*       operator -> () { return (sockunixbuf*)rdbuf (); }
};

#endif  // _SOCKUNIX_H