当前位置: 首页>>代码示例>>C++>>正文


C++ SipMessage::exists方法代码示例

本文整理汇总了C++中SipMessage::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ SipMessage::exists方法的具体用法?C++ SipMessage::exists怎么用?C++ SipMessage::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SipMessage的用法示例。


在下文中一共展示了SipMessage::exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: save

// NOTE: This is not the most elegant code however, some concessions were made to
// make this as fast as possible as you could get hundreds of inserts per second
void HEPDao::save(StateQueueMessage& object)
{
  int outgoing = 0;
  int ipProtoId = HEPMessage::TCP;
  std::string ip4SrcAddress;
  std::string ip4DestAddress;
  int srcPort = 0;
  int destPort = 0;
  double timeStamp = 0;
  double timeStampMicroOffset = 0;
  std::string data;

  if (!object.get("Outgoing", outgoing))
    return;

#if 0 //  For now we determine this using the VIA header since the sipstack
      //  does not include the transport type in the processor callback
  if (!object.get("IpProtoId", ipProtoId))
    return;
#endif

  if (!object.get("Ip4SrcAddress", ip4SrcAddress))
    return;

  if (!object.get("Ip4DestAddress", ip4DestAddress))
    return;

  if (!object.get("SrcPort", srcPort))
    return;

  if (!object.get("DestPort", destPort))
    return;

  if (!object.get("TimeStamp", timeStamp))
    return;

  if (!object.get("TimeStampMicroOffset", timeStampMicroOffset))
    return;

  if (!object.get("Data", data))
    return;


  Data buffer(data.c_str());

  SipMessage* msg = SipMessage::make(buffer);

  if (!msg)
    return;

  if (msg->isInvalid())
  {
    delete msg;
    return;
  }

  SQLRETURN err = SQLFreeStmt(mInsert, SQL_UNBIND);
  checkError(err, mInsert, SQL_HANDLE_STMT);
  mFieldIndex = 0;

  struct timeval now;
  now.tv_sec = timeStamp;
  now.tv_usec = timeStampMicroOffset;
  time_t timeNow = now.tv_sec;
  struct tm* gmt = gmtime (&timeNow);

  // date
  TIMESTAMP_STRUCT date;
  date.year = gmt->tm_year + 1900;
  date.month = gmt->tm_mon + 1;
  date.day = gmt->tm_mday;
  date.hour = gmt->tm_hour;
  date.minute = gmt->tm_min;
  date.second = gmt->tm_sec;
  date.fraction = 0;
  bind(DATE, &date, sizeof(date));

  // micro_ts
  unsigned long long microTs = (unsigned long long)now.tv_sec*1000000+now.tv_usec;
  bind(MICRO_TS, &microTs, sizeof(unsigned long long));


  // method
  std::string cseqMethod;
  if (msg->exists(h_CSeq))
  {
    switch(msg->const_header(h_CSeq).method())
    {
    case ACK:
      cseqMethod = "ACK";
      break;
    case BYE:
      cseqMethod = "BYE";
      break;
    case CANCEL:
      cseqMethod = "CANCEL";
      break;
    case INVITE:
//.........这里部分代码省略.........
开发者ID:dreamsxin,项目名称:sipXhomer,代码行数:101,代码来源:HEPDao.cpp


注:本文中的SipMessage::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。