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

# beepchannel.c File Reference

The Implementation of the BEEP Channel object. More...

`#include <assert.h>`
`#include "config.h"`
`#include "liblogging.h"`
`#include "beepchannel.h"`
`#include "beepframe.h"`
`#include "namevaluetree.h"`

## Functions
srRetVal | sbChanSetChanno (sbChanObj *pThis, int iChanno)
| Set the channel number for this channel (done by channel 0 profile).
sbChanObj * | sbChanConstruct (sbSessObj *pSess)
srRetVal | sbChanActualSendFram (sbChanObj *pThis, sbFramObj *pFram)
void | sbChanAbort (sbChanObj *pThis)
| Aborts a channel.
void | sbChanDestroy (sbChanObj *pThis)
| Destructor.
srRetVal | sbChanUpdateChannelState (sbChanObj *pThis, int iNewState)
| Update the channel status.
srRetVal | sbChanAssignProfile (sbChanObj *pThis, sbProfObj *pProf)
srRetVal | sbChanSetAwaitingClose (sbChanObj *pThis)
| Set the channel status to "awaiting close".
srRetVal | sbChanSetChanClosed (sbChanObj *pThis)
| Set channel state to closed.
srRetVal | sbChanSendOK (sbChanObj *pThis, void(*OnFrameDestroy)(sbFramObj *), void *pUsr)
srRetVal | sbChanSendSEQ (sbChanObj *pThis, unsigned uAckno, unsigned uWindow)
| Send a SEQ frame for the current channel.
srRetVal | sbChanSendErrResponse (sbChanObj *pThis, unsigned uErrCode, char *pszErrMsg)
| Send an error response to the remote peer.

## Detailed Description

The Implementation of the BEEP Channel object.

Author:
  Rainer Gerhards <rgerhards@adiscon.com>

Date:
  2003-08-04

  2003-08-07

  - added support for the session's channel linked lies.

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 name of Adiscon GmbH or 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

void sbChanAbort | ( | sbChanObj * | pThis | ) |

| Aborts a channel. That is, it destroys the channel object itself but DOES NOT remove it from the session's linked list of channels.

void sbChanDestroy | ( | sbChanObj * | pThis | ) |

| Destructor. The channel object itself will be freed and can not be used any longer.

srRetVal sbChanSendErrResponse | ( | sbChanObj * | pThis,
|  | unsigned | uErrCode,
|  | char * | pszErrMsg
| ) |

  | Send an error response to the remote peer. Parameters:
  uErrCode | numeric error code as of RC 3080
  pszErrMsg | human-readable error message string. MUST NOT be NULL.

srRetVal sbChanSendSEQ | ( | sbChanObj * | pThis,
|  | unsigned | uAckno,
|  | unsigned | uWindow
| ) |

  | Send a SEQ frame for the current channel. Parameters:
  pChan | Channel this SEQ is for.
  uAckno | ackno to use in the SEQ. Can not be 0.
  uWindow | Window to use in the SEQ. If 0, use BEEP default.

srRetVal sbChanSetChanno | ( | sbChanObj * | pThis,
|  | int | iChanno
| ) |

  | Set the channel number for this channel (done by channel 0 profile). IMPORTANT: the channel number MUST be set only ONCE and this BEFORE any data is sent or received over the channel. The reason for this is that this method also adds the channel to session's list of channel objects. If it would be called multiple times, multiple copies would be present in the list - which would (mildly said) cause unpredictable results). Of course, we could change the behaviour to handle this case, but I do not see any good reason for this. So far, it looks like a waste of CPU cycles... Parameters:
  iChanno | [in] Channel number to be used on this channel.

srRetVal sbChanUpdateChannelState | ( | sbChanObj * | pThis,
|  | int | iNewState
| ) |

  | Update the channel status. Parameters:
  iNewState | new channel status