aboutsummaryrefslogtreecommitdiffstats
path: root/docs/reference/cmdreference/vhost/vhostuser.rst
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-08-07 21:39:27 -0700
committerFlorin Coras <florin.coras@gmail.com>2019-08-09 15:10:18 +0000
commit1403fe604729078fb8a5e1f73cac1ae7ca4b8a8d (patch)
treed0196659398a87d1beef6e2a2197ff767d8c013f /docs/reference/cmdreference/vhost/vhostuser.rst
parent58e95bc2cdff71fb72e8b2e150cfb8e0d8e64103 (diff)
tls: handle transport reset
Type:fix Change-Id: I5994fb53dc4b9fd58920b3d67472c38b41db27c2 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit f03c49413f270386d46a82dd9a3bce819cf81250)
Diffstat (limited to 'docs/reference/cmdreference/vhost/vhostuser.rst')
0 files changed, 0 insertions, 0 deletions
ring.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#ifndef _BASIC_UTILS_H
#define _BASIC_UTILS_H

/*
Copyright (c) 2015-2015 Cisco Systems, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#include "c_common.h"
#include <stdio.h>
#include <string>

/**
 * the round must be power 2 e.g 2,4,8...
 * 
 * @param num
 * @param round
 * @return 
 */
inline uint utl_align_up(uint num,uint round){
    if ((num & ((round-1)) )==0) {
        //the number align
        return(num);
    }
    return( (num+round) & (~(round-1)) );
}

inline uint utl_align_down(uint num,uint round){
    return( (num) & (~(round-1)) );
}


void utl_DumpBuffer(FILE* fp,void  * src,  unsigned int size,int offset=0);



#define SHOW_BUFFER_ADDR_EN     1
#define SHOW_BUFFER_ADDR        2
#define SHOW_BUFFER_CHAR        4

#define SHOW_BUFFER_ALL (SHOW_BUFFER_ADDR_EN|SHOW_BUFFER_ADDR|SHOW_BUFFER_CHAR)

void utl_DumpBuffer2(FILE* fd,
                     void  * src,  
                     unsigned int size, //buffer size
                     unsigned int width ,
                     unsigned int width_line ,
                     unsigned int mask);



#undef min
#undef max

template <class T>
inline const T& utl_min(const T& a, const T& b) {
  return b < a ? b : a;
}

template <class T>
inline const T& utl_max(const T& a, const T& b) {
  return  a < b ? b : a;
}

template <class T>
inline void utl_swap(T& a, T& b) {
  T tmp = a;
  a = b;
  b = tmp;
}


bool utl_is_file_exists (const std::string& name) ;

void utl_macaddr_to_str(const uint8_t *macaddr, std::string &output);

std::string utl_generate_random_str(unsigned int &seed, int len);

#endif