Main Page | Compound List | File List | Compound Members | File Members | Related Pages

beepsession.c File Reference

Implementation of the BEEP Session Object. More...

#include <assert.h>
#include "config.h"
#include "liblogging.h"
#include "sockets.h"
#include "beepsession.h"
#include "beepchannel.h"
#include "beepframe.h"
#include "namevaluetree.h"
#include "stringbuf.h"

Functions

sbChanObjsbSessRetrChanObj (sbSessObj *pThis, SBchannel uChanNo)
 Retrieve the channel object associated with the channel number.

srRetVal sbSessProcessGreeting (sbSessObj *pThis, sbMesgObj *pMesg)
sbSessObjsbSessOpenSession (char *pszRemotePeer, int iPort, sbNVTRObj *pProfSupported)
srRetVal sbSessDoSEQ (sbSessObj *pThis, sbFramObj *pFram)
 Process the supplied SEQ frame.

void sbSessDestroy (sbSessObj *pThis)
 Destructor.

srRetVal sbSessDoReceive (sbSessObj *pThis, int bMustRcvPayloadFrame)
 Receive frames off the tcp stream.

sbFramObjsbSessRecvFram (sbSessObj *pThis, sbChanObj *pChan)
srRetVal sbSessSendFram (sbSessObj *pThis, sbFramObj *pFram, sbChanObj *pChan)
sbChanObjsbSessOpenChan (sbSessObj *pThis)
 Open a BEEP channel on an established session.

srRetVal sbSessCloseChan (sbSessObj *pThis, sbChanObj *pChan)
srRetVal sbSessCloseSession (sbSessObj *pThis)
 Closes the BEEP session.

srRetVal sbSessSendGreeting (sbSessObj *pSess, sbNVTRObj *pProfsSupported)


Detailed Description

Implementation of the BEEP Session Object.

Author:
Rainer Gerhards <rgerhards@adiscon.com>
Date:
2003-08-04

2003-08-11 Integrated XML parser in closeSession and other areas (begun implementing it).

2003-08-12 Added a list of remote peers profile to the session object. Now the sbSessOpenChan() can do intelligent checking if the remote peer supports the profile (and, if not, provide an error message and not try to connect).

2003-09-04 Added support for multiple initiator (client) profiles.

Copyright 2002-2003 Rainer Gerhards and Adiscon GmbH. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the names of Adiscon GmbH nor Rainer Gerhards nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Function Documentation

srRetVal sbSessCloseSession sbSessObj pThis  ) 
 

Closes the BEEP session.

First, the management channel (channel 0) is taken down and then the TCP stream is closed. This function can only be called after all sessions have been closed. Once the function returns, the session object is no longer valid and can no longer be used.

void sbSessDestroy sbSessObj pThis  ) 
 

Destructor.

pThis is invalid when this function returns. The caller can no longer use it. The caller is also not allowed to free it - this is already done in this method.

srRetVal sbSessDoReceive sbSessObj pThis,
int  bMustRcvPayloadFrame
 

Receive frames off the tcp stream.

SEQ frames are processed as they arrive. Other frames are buffered in the respective in-memory queue. This is a helper to sbSessRecvFram() and sbSessSendFram().

Parameters:
bMustRcvPayloadFrame A boolean indicating if an actual payload frame must be received. If set to TRUE, the method blocks until a payload frame is received. All interim SEQ frames are processed, but will not make this method to return. If FALSE, the method will block until anything is received, including a SEQ. If a SEQ is received, it will be processed and the method returns.

srRetVal sbSessDoSEQ sbSessObj pThis,
sbFramObj pFram
 

Process the supplied SEQ frame.

Most notably, this means the window is updated in the respective channel object.

According to the latest discussion on the BEEP WG mailing list and other sources, we silently ignore SEQ frames for non-existing channels. This most probably is not a protocol error but rather a SEQ frame arriving after the channel has been closed. This can happen due to TCP delays. Other implementors have suggested (and successfully implemented) ignoring these frames. This information is current as of August, 2003.

Parameters:
pFram pointer to frame to process.

sbChanObj* sbSessOpenChan sbSessObj pThis  ) 
 

Open a BEEP channel on an established session.

Todo:
think if we need to shut down anything else inside the BEEP session.

think if we need to shut down anything else inside the BEEP session.

sbFramObj* sbSessRecvFram sbSessObj pThis,
sbChanObj pChan
 

Todo:
think about a timeout here - we could block indefinitely...

sbChanObj* sbSessRetrChanObj sbSessObj pThis,
SBchannel  uChanNo
 

Retrieve the channel object associated with the channel number.

This method allows to retrieve a channel number based on the actual channel.

Parameters:
uChanNo channel number
Return values:
pointer to channel object or NULL, if uChanNo could not be found.


Generated on Mon Oct 3 12:29:55 2005 for liblogging by doxygen 1.3.2