1 : //=============================================================================
2 : // File <$/src/cpp/prod/com/MsgCom.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, 2006, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //=============================================================================
21 :
22 : #include <sys/types.h>
23 : #include <sys/ipc.h>
24 : #include <sys/msg.h>
25 :
26 : #include <yaorb/CORBA.h>
27 :
28 : #include "src/cpp/prod/com/MsgCom.h"
29 :
30 : // FIXME : need message queues ?
31 : // there might not be a need for this anyway, to investigate
32 :
33 :
34 : #ifdef LATER
35 : // The real data starts at **offset** in struct msgbuf :
36 : // sizeof (mtype) is not portable, due to padding,
37 : // so let the compiler do the black magic ...
38 : static const int offset =
39 : & ((struct msgbuf*)(NULL))->mtext[0]
40 : - (char*) & ((struct msgbuf*)(NULL))->mtype ;
41 : #endif
42 :
43 :
44 0 : MsgCom::MsgCom(int msqid)
45 : : Com(),
46 0 : _msqid(msqid)
47 : {
48 : }
49 :
50 0 : MsgCom::~MsgCom()
51 0 : {}
52 :
53 : void
54 0 : MsgCom::ReadBuffer(Buffer & buf)
55 : {
56 : // FIXME : see SockCom
57 :
58 : #ifdef LATER
59 : int cr ;
60 : CORBA::Octet *tmpdata ;
61 : int tmpsize ;
62 :
63 : tmpdata = _buf.GetData() ;
64 : tmpsize = _buf.GetSize() ;
65 :
66 : struct msgbuf *msgp = (struct msgbuf*) tmpdata ;
67 : int msgsz = tmpsize - offset ;
68 : long msgtyp = 0 ;
69 : int msgflg = 0 ;
70 :
71 : cr = msgrcv(_msqid, msgp, msgsz, msgtyp, msgflg) ;
72 :
73 : data = tmpdata + offset ;
74 : size = tmpsize - offset ;
75 :
76 : #endif
77 :
78 : return ;
79 : }
80 :
81 : void
82 0 : MsgCom::WriteBuffer(const Buffer & buf)
83 : {
84 : // FIXME
85 : }
86 :
87 : void
88 0 : MsgCom::Close(void)
89 : {
90 : // FIXME
91 : }
92 :
|