Ejemplo n.º 1
0
/*
 * ZoneEdit OK codes are:
 *  CODE=200, 201
 *  CODE=707, for duplicated updates
 */
static int response(http_trans_t *trans, ddns_info_t *info, ddns_alias_t *alias)
{
	int code = -1;

	DO(http_status_valid(trans->status));

	sscanf(trans->rsp_body, "%*s CODE=\"%4d\" ", &code);
	switch (code) {
	case 200:
	case 201:
	case 707:
		/* XXX: is 707 really OK? */
		return 0;
	default:
		break;
	}

	return RC_DDNS_RSP_NOTOK;
}
Ejemplo n.º 2
0
void ML_(fill_elffpxregs_from_tst)(vki_elf_fpxregset_t* xfpu,
                                   const ThreadArchState* arch)
{
//::    xfpu->cwd = ?;
//::    xfpu->swd = ?;
//::    xfpu->twd = ?;
//::    xfpu->fop = ?;
//::    xfpu->fip = ?;
//::    xfpu->fcs = ?;
//::    xfpu->foo = ?;
//::    xfpu->fos = ?;
//::    xfpu->mxcsr = ?;
   xfpu->reserved = 0;
//::    xfpu->st_space = ?;

#  define DO(n)  VG_(memcpy)(xfpu->xmm_space + n * 4, &arch->vex.guest_XMM##n, sizeof(arch->vex.guest_XMM##n))
   DO(0);  DO(1);  DO(2);  DO(3);  DO(4);  DO(5);  DO(6);  DO(7);
#  undef DO

   VG_(memset)(xfpu->padding, 0, sizeof(xfpu->padding));
}
Ejemplo n.º 3
0
Archivo: km.c Proyecto: indera/kona
//Arthur says he doesn't use malloc or free. Andrei Moutchkine claims smallest unit is vm page (his truss says no malloc + add pages one at a time).
//Arthur not using malloc is probably true. No strdup & related functions in binary's strings. Note: Skelton references "different allocator" not in \w report
//This source would be improved by getting ridding of remaing malloc/calloc/realloc
K cd(K x)
{
  #ifdef DEBUG
  if(x && x->c <=0 ) { er(Tried to cd() already freed item) dd(tests) dd((L)x) dd(x->c) dd(x->t) dd(x->n) show(x); }
  #endif 

  P(!x,0)
  x->c -= 1;

  SW(xt)
  {
    CSR(5,)
    CS(0, DO(xn, cd(kK(x)[xn-i-1]))) //repool in reverse, attempt to maintain order
  }

  if(x->c > 0) R x;

  #ifdef DEBUG
  DO(kreci, if(x==krec[i]){krec[i]=0; break; })
VBGLR3DECL(int) VbglR3DnDGHErrorEvent(int rcOp)
{
    DO(("GH_ERROR\n"));

    /* Initialize header */
    DragAndDropSvc::VBOXDNDGHEVTERRORMSG Msg;
    RT_ZERO(Msg);
    Msg.hdr.result      = VERR_WRONG_ORDER;
    Msg.hdr.u32ClientID = g_clientId;
    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_EVT_ERROR;
    Msg.hdr.cParms      = 1;
    /* Initialize parameter */
    Msg.uRC.SetUInt32(rcOp);
    /* Do request */
    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    if (RT_SUCCESS(rc))
        rc = Msg.hdr.result;
    return rc;
}
Ejemplo n.º 5
0
Archivo: price.c Proyecto: kevinarpe/kx
void drawkeys()
{
  int len,h2,x,y,*kx;
  len=Key->n;
  if (2>len) return;
  h2=LabelHit/2;
  kx=g_malloc(len*sizeof(int));
  pango_layout_set_font_description(PL,LabelFont);
  DO(len,kx[i]=gettextwidth(Key->v[i]));
  x=Gx+Gw-(10+KeyWid+maxi(len,kx));
  y=Gy+10+h2;
  cairo_set_line_width(CR,2);
  DO(len,{
    cairo_set_source(CR,glcolor(i));
    cairo_move_to(CR,x,y);
    cairo_line_to(CR,x+KeyWid,y);
    cairo_stroke(CR);
    y+=LabelHit;
  });
Ejemplo n.º 6
0
int pkcs_1_emsa_test(void)
{
  int hash_idx = find_hash("sha1");
  unsigned int i;
  unsigned int j;

  DO(hash_is_valid(hash_idx));

  for (i = 0; i < sizeof(testcases_emsa)/sizeof(testcases_emsa[0]); ++i) {
    testcase_t* t = &testcases_emsa[i];
    rsa_key k, *key = &k;
    DOX(mp_init_multi(&key->e, &key->d, &key->N, &key->dQ,
                       &key->dP, &key->qP, &key->p, &key->q, NULL), t->name);

    DOX(mp_read_unsigned_bin(key->e, t->rsa.e, t->rsa.e_l), t->name);
    DOX(mp_read_unsigned_bin(key->d, t->rsa.d, t->rsa.d_l), t->name);
    DOX(mp_read_unsigned_bin(key->N, t->rsa.n, t->rsa.n_l), t->name);
    DOX(mp_read_unsigned_bin(key->dQ, t->rsa.dQ, t->rsa.dQ_l), t->name);
    DOX(mp_read_unsigned_bin(key->dP, t->rsa.dP, t->rsa.dP_l), t->name);
    DOX(mp_read_unsigned_bin(key->qP, t->rsa.qInv, t->rsa.qInv_l), t->name);
    DOX(mp_read_unsigned_bin(key->q, t->rsa.q, t->rsa.q_l), t->name);
    DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
    key->type = PK_PRIVATE;

    for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
        rsaData_t* s = &t->data[j];
        unsigned char buf[20], obuf[256];
        unsigned long buflen = sizeof(buf), obuflen = sizeof(obuf);
        int stat;
        DOX(hash_memory(hash_idx, s->o1, s->o1_l, buf, &buflen), s->name);
        DOX(rsa_sign_hash_ex(buf, buflen, obuf, &obuflen, LTC_PKCS_1_V1_5, NULL, -1, hash_idx, 0, key), s->name);
        DOX(obuflen == (unsigned long)s->o2_l?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
        DOX(memcmp(s->o2, obuf, s->o2_l)==0?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
        DOX(rsa_verify_hash_ex(obuf, obuflen, buf, buflen, LTC_PKCS_1_V1_5, hash_idx, 0, &stat, key), s->name);
        DOX(stat == 1?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
    } /* for */

    mp_clear_multi(key->d,  key->e, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL);
  } /* for */

  return 0;
}
Ejemplo n.º 7
0
Archivo: util.c Proyecto: kevinarpe/kx
double *getklist(K p)
{
  double *r;

  r=g_malloc(p->n*sizeof(double));
  switch(p->t){
    case 1 : case 4 : DO(p->n,r[i]=kG(p)[i]);break;
    case 5 : DO(p->n,r[i]=kH(p)[i]);break;
    case 6 : case 13 : case 14 : case 17 : case 18 :
      DO(p->n,r[i]=kI(p)[i]);break;
    case 7 : case 16 : DO(p->n,r[i]=kJ(p)[i]);break;
    case 8 : DO(p->n,r[i]=kE(p)[i]);break;
    case 9 : case 15 : DO(p->n,r[i]=kF(p)[i]);break;
    case 10 : DO(p->n,r[i]=kC(p)[i]);break;
    default : g_free(r);return (double *)kerr("invalid numeric type");
  }
  return r;
}
Ejemplo n.º 8
0
VBGLR3DECL(int) VbglR3DnDHGRequestData(const char* pcszFormat)
{
    DO(("DATA_REQ: '%s'\n", pcszFormat));
    /* Validate input */
    AssertPtrReturn(pcszFormat, VERR_INVALID_PARAMETER);

    /* Initialize header */
    DragAndDropSvc::VBOXDNDHGREQDATAMSG Msg;
    RT_ZERO(Msg);
    Msg.hdr.result      = VERR_WRONG_ORDER;
    Msg.hdr.u32ClientID = g_clientId;
    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_REQ_DATA;
    Msg.hdr.cParms      = 1;
    /* Do request */
    Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    if (RT_SUCCESS(rc))
        rc = Msg.hdr.result;
    return rc;
}
Ejemplo n.º 9
0
    QString to_source_f<QVariant>::operator()( QVariant const & x ) const
    {
	switch( x.userType() )
	{
#define DO(VT,T) \
	    case QVariant::VT: \
		return qboard::toSource( x.value<T>() ); break;

	    DO(Int,int);
	    DO(Double,int);
	    DO(String,QString);
	    DO(Point,QPoint);
	    DO(PointF,QPointF);
	    DO(Rect,QRect);
	    DO(RectF,QRectF);
	    DO(Size,QSize);
	    DO(SizeF,QSizeF);
	    DO(Color,QColor);
	  default:
	      break;
#undef DO
	};
	return QString("undefined");
    }
Ejemplo n.º 10
0
VBGLR3DECL(int) VbglR3DnDGHAcknowledgePending(uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormat)
{
    DO(("PEND: %u: %u (%s)\n", uDefAction, uAllActions, pcszFormat));
    /* Validate input */
    AssertPtrReturn(pcszFormat, VERR_INVALID_POINTER);

    /* Initialize header */
    DragAndDropSvc::VBOXDNDGHACKPENDINGMSG Msg;
    RT_ZERO(Msg);
    Msg.hdr.result      = VERR_WRONG_ORDER;
    Msg.hdr.u32ClientID = g_clientId;
    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_ACK_PENDING;
    Msg.hdr.cParms      = 3;
    /* Initialize parameter */
    Msg.uDefAction.SetUInt32(uDefAction);
    Msg.uAllActions.SetUInt32(uAllActions);
    Msg.pFormat.SetPtr((void*)pcszFormat, static_cast<uint32_t>(strlen(pcszFormat) + 1));
    /* Do request */
    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    if (RT_SUCCESS(rc))
        rc = Msg.hdr.result;
    return rc;
}
Ejemplo n.º 11
0
Archivo: hex.c Proyecto: mrahn/hex
static uint8_t winner_from (PPosition_type pos, PState_DFS state, int f)
{
  prepare_state (state, f);

  int mi = (pos->player == L) ? X(f) : Y(f);
  int ma = (pos->player == L) ? X(f) : Y(f);

  while (not_done (state))
  {
    int const px = pop (state);
    int const py = pop (state);

#define DO(dx, dy)                                                      \
    if (  (px + dx) >= 0 && (px + dx) <= SIZE                           \
       && (py + dy) >= 0 && (py + dy) <= SIZE                           \
       && pos->taken[LIN ((px + dx), (py + dy))] == pos->player         \
       )                                                                \
    {                                                                   \
      if (not_seen (state, px + dx, py + dy))                           \
      {                                                                 \
        mi = MIN (mi, (pos->player == L) ? (px + dx) : (py + dy));      \
        ma = MAX (ma, (pos->player == L) ? (px + dx) : (py + dy));      \
                                                                        \
        if (mi == 0 && ma == SIZE)                                      \
        {                                                               \
          return pos->player;                                           \
        }                                                               \
                                                                        \
        push (state, px + dx, py + dy);                                 \
      }                                                                 \
    }                                                                   \

    DO ( 0, 1);
    DO ( 1, 1);
    DO ( 1, 0);
    DO ( 0,-1);
    DO (-1,-1);
    DO (-1, 0);

#undef DO
  }

  return N;
}
Ejemplo n.º 12
0
Archivo: vg.c Proyecto: 0branch/kona
K grade_updown(K a, I r)
{
  I at=a->t, an=a->n;
  P(0< at, RE)
  if(-4==at)R symGrade(a,r);
  if(-3==at)R charGrade(a,r);
  if(-1==at||-2==at){
    K z;
    if(an<2){z=newK(-1,an);M(z);DO(an,kI(z)[i]=i);R z;}
    else{
      K x=0;uI y,u=(uI)-1,v=0,h=0,k;//MIN,MAX
      if(-2==at){x=newK(-1,an);M(x);}
      //trst();
      //elapsed("x=newK");
      if(-1==at)DO(an,y=kI(a)[i];h|=y;if(y<u)u=y;if(y>v)v=y)
      else DO(an,kU(x)[i]=(y=FtoI(kF(a)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)
      //elapsed("fill x");
      //O("u:%016llx v:%016llx\n",u,v);
      if((r&&-1==at)||((u&MSB)!=(v&MSB))){
        u=(uI)-1;v=0;h=0;
        if(-1==at){
          x=newK(-1,an);M(x);
          DO(an,kU(x)[i]=(y=ItoU(kI(a)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)}
        else DO(an,kU(x)[i]=(y=ItoU(kI(x)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)}
Ejemplo n.º 13
0
int DnDManager::nextMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
{
    AssertPtrReturn(puMsg, VERR_INVALID_POINTER);
    AssertPtrReturn(pcParms, VERR_INVALID_POINTER);

    int rc = VINF_SUCCESS;

    if (m_pCurMsg)
        rc = m_pCurMsg->currentMessageInfo(puMsg, pcParms);
    else
    {
        if (m_dndMessageQueue.isEmpty())
        {
            rc = VERR_NO_DATA;
//            if (m_pfnProgressCallback)
//                m_pfnProgressCallback(100.0, DragAndDropSvc::DND_OP_CANCELLED, m_pvProgressUser);
        }
        else
            rc = m_dndMessageQueue.first()->currentMessageInfo(puMsg, pcParms);
    }

    DO(("next msg info: %d %d %Rrc\n", *puMsg, *pcParms, rc));
    return rc;
}
Ejemplo n.º 14
0
static int response(http_trans_t *trans, ddns_info_t *UNUSED(info), ddns_alias_t *UNUSED(alias))
{
	int   code = -1;
	char *tmp;

	DO(http_status_valid(trans->status));

	tmp = strstr(trans->p_rsp_body, "\n");
	if (tmp)
		sscanf(++tmp, "%4d=", &code);

	switch (code) {
	case 0:
	case 1:
		return 0;
	case 4:
	case 11:
		return RC_DYNDNS_RSP_RETRY_LATER;
	default:
		break;
	}

	return RC_DYNDNS_RSP_NOTOK;
}
Ejemplo n.º 15
0
Archivo: ko.c Proyecto: elrzn/kona
K kclone(K a)//Deep copy -- eliminate where possible
{
  if(!a) R 0;
  I t=a->t,n=a->n;
  K z= 7==t?Kv():newK(t,n);
  if     (4==ABS(t)) DO(n, kS(z)[i]=kS(a)[i])  //memcpy everywhere is better
  else if(3==ABS(t)) DO(n, kC(z)[i]=kC(a)[i]) 
  else if(2==ABS(t)) DO(n, kF(z)[i]=kF(a)[i]) 
  else if(1==ABS(t)) DO(n, kI(z)[i]=kI(a)[i]) 
  else if(0==    t ) DO(n, kK(z)[i]=kclone(kK(a)[i])) 
  else if(5==    t ) DO(n, kK(z)[i]=kclone(kK(a)[i]))
  else if(7==    t )
  {
    I k=0;

    z->t=a->t; 
    I vt=z->n = a->n;
    K kv;

    V*v;
    SW(vt)
    {
      CS(1, k=((K)kV(a)[CODE])->n-1;
            M(z,kv=newK(-4,k+1))
            v=(V*)kK(kv);
            //v[k]=0;//superfluous reminder
            DO(k, V w=kW(a)[i];
                  if(VA(w))v[i]=w;  //TODO: is this ok for NAMES? see similar code in capture()
                  else
                  {
                    K r=kclone(*(K*)w); //oom
                    V q=newE(LS,r); //oom
                    kap((K*) kV(z)+LOCALS,&q);//oom
                    cd(q);//kap does ci
                    q=EVP(q); //oom free z etc. kap needs checking 
                    v[i]=q;
                  }
              )
      )
      CS(2, M(z,kv=newK(-4,3))
            v=(V*)kK(kv);
            memcpy(v,kW(a),3*sizeof(V));
        )
Ejemplo n.º 16
0
A gfarray(D *d, I n) { A z; D *zv;
    z=ga(FLT,1,n,NULL);
    zv=DAV(z);
    DO(n, zv[i]=d[i]);
    R z;
}
Ejemplo n.º 17
0
A giarray(I *ints, I n) { A z=ga(INT,1,n,NULL); I *zv=IAV(z);
    DO(n, zv[i]=ints[i]);
    R z;
}
Ejemplo n.º 18
0
static int setup_fpu(int doINV, int doOFL)
{
   
#if defined(WIN32)
   
  /* Win32 uses _controlfp() */
   
   unsigned int mask = _controlfp(0,0);
   fpe_inv = doINV;
   fpe_ofl = doOFL;
   if (doINV) mask&=(~_EM_INVALID); else mask|=(_EM_INVALID);
   if (doOFL) mask&=(~_EM_OVERFLOW); else mask|=(_EM_OVERFLOW);
   if (doOFL) mask&=(~_EM_ZERODIVIDE); else mask|=(_EM_ZERODIVIDE);
   _controlfp(mask, _MCW_EM);
   return 1;

#elif defined(HAVE_FPSETMASK)

   /* SysVr4 defines fpsetmask() */
   
   int mask = 0;
   fpe_inv = doINV;
   fpe_ofl = doOFL;
#ifdef FP_X_INV
   if (doINV) mask |= FP_X_INV;
#endif
#ifdef FP_X_OFL
   if (doOFL) mask |= FP_X_OFL;
#endif
#ifdef FP_X_DZ
   if (doOFL) mask |= FP_X_DZ;
#endif
   fpsetmask( mask );
   return 1;
  
#elif defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT)

   /* GLIBC-2.2 model */
   
   int mask1 = 0;
   int mask2 = 0;
   fpe_inv = doINV;
   fpe_ofl = doOFL;

#ifdef FE_INVALID
   if (doINV) 
      mask1 |= FE_INVALID;
   else
      mask2 |= FE_INVALID;    
#endif
#ifdef FE_DIVBYZERO
   if (doOFL) 
      mask1 |= FE_DIVBYZERO;
   else
      mask2 |= FE_DIVBYZERO;    
#endif
#ifdef FE_OVERFLOW
   if (doOFL) 
      mask1 |= FE_OVERFLOW;
   else
      mask2 |= FE_OVERFLOW;    
#endif
   feenableexcept(mask1);
   fedisableexcept(mask2);
   return 1;

#elif defined(HAVE_FPU_CONTROL_H)

   /* Older GLIBC */
  
   int mask = 0;
   fpe_inv = doINV;
   fpe_ofl = doOFL;
   
#ifdef _FPU_DEFAULT
   mask = _FPU_DEFAULT;
#endif
  
#define DO(c,f) mask=((c)?(mask|(f)):(mask&~(f)));

#if defined(__i386__) || defined(__alpha__)
#ifdef _FPU_MASK_IM
   DO(!doINV, _FPU_MASK_IM);
#endif
#ifdef _FPU_MASK_OM
   DO(!doOFL, _FPU_MASK_OM);
#endif
#ifdef _FPU_MASK_ZM
   DO(!doOFL, _FPU_MASK_ZM);
#endif
#else
#ifdef _FPU_MASK_IM
   DO(doINV, _FPU_MASK_IM);
#endif
#ifdef _FPU_MASK_OM
   DO(doOFL, _FPU_MASK_OM);
#endif
#ifdef _FPU_MASK_ZM
   DO(doOFL, _FPU_MASK_ZM);
#endif
#ifdef _FPU_MASK_V
   DO(doINV, _FPU_MASK_V);
#endif
#ifdef _FPU_MASK_O
   DO(doOFL, _FPU_MASK_O);
#endif
#ifdef _FPU_MASK_Z
   DO(doOFL, _FPU_MASK_Z);
#endif
#ifdef _FPU_MASK_OPERR
   DO(doINV, _FPU_MASK_OPERR);
#endif
#ifdef _FPU_MASK_OVFL
   DO(doOFL, _FPU_MASK_OPERR);
#endif
#ifdef _FPU_MASK_DZ
   DO(doOFL, _FPU_MASK_DZ);
#endif
#endif
  /* continue */
#if defined(HAVE___SETFPUCW)
   __setfpucw( mask );
   return 1;
#elif defined(_FPU_SETCW)
   _FPU_SETCW( mask );
   return 1;
#undef DO
#endif

#endif
   
   /* Default */
   return 0;
}
Ejemplo n.º 19
0
 static inline void        start(const Block *s, const Block *e)        { DO(gCallback->start(s, e));      }
Ejemplo n.º 20
0
 static inline void  startOutput(const uint8_t *p)                      { DO(gCallback->startOutput(p));   }
Ejemplo n.º 21
0
 static inline void   endOutputs(const uint8_t *p)                      { DO(gCallback->endOutputs(p));    }
Ejemplo n.º 22
0
 static inline void  startInputs(const uint8_t *p)                      { DO(gCallback->startInputs(p));   }
Ejemplo n.º 23
0
 static inline void      startTX(const uint8_t *p, const uint8_t *hash) { DO(gCallback->startTX(p, hash)); }
Ejemplo n.º 24
0
 static inline void     endBlock(const uint8_t *p)                      { DO(gCallback->endBlock(p));      }
Ejemplo n.º 25
0
void
showip6(void)
{
	struct ip6stat stats;
	uint64_t totalout;

	domode(&stats);
	totalout = stats.ip6s_forward + stats.ip6s_localout;

#define DO(stat, row, col) \
	mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat)

	DO(ip6s_total, 1, 0);
	mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout);
	DO(ip6s_tooshort, 2, 0);
	DO(ip6s_localout, 2, 35);
	DO(ip6s_toosmall, 3, 0);
	DO(ip6s_odropped, 3, 35);
	DO(ip6s_badvers, 4, 0);
	DO(ip6s_ofragments, 4, 35);
	DO(ip6s_fragments, 5, 0);
	DO(ip6s_cantfrag, 5, 35);
	DO(ip6s_fragdropped, 6, 0);
	DO(ip6s_noroute, 6, 35);
	DO(ip6s_fragtimeout, 7, 0);
	DO(ip6s_rawout, 7, 35);
	DO(ip6s_fragoverflow, 8, 0);
	DO(ip6s_atomicfrags, 9, 0);
	DO(ip6s_reassembled, 10, 0);
	DO(ip6s_forward, 11, 0);
	DO(ip6s_nxthist[IPPROTO_DSTOPTS], 10, 35);
	DO(ip6s_cantforward, 12, 0);
	DO(ip6s_nxthist[IPPROTO_HOPOPTS], 11, 35);
	DO(ip6s_redirectsent, 13, 0);
	DO(ip6s_nxthist[IPPROTO_IPV4], 12, 35);
	DO(ip6s_badoptions, 14, 0);
	DO(ip6s_nxthist[IPPROTO_TCP], 13, 35);
	DO(ip6s_notmember, 15, 0);
	DO(ip6s_nxthist[IPPROTO_UDP], 14, 35);
	DO(ip6s_delivered, 16, 0);
	DO(ip6s_nxthist[IPPROTO_IPV6], 15, 35);
	DO(ip6s_badscope, 17, 0);
	DO(ip6s_nxthist[IPPROTO_ROUTING], 16, 35);
	DO(ip6s_sources_none, 18, 0);
	DO(ip6s_nxthist[IPPROTO_FRAGMENT], 17, 35);
	DO(ip6s_nxthist[IPPROTO_ICMPV6], 18, 35);
	DO(ip6s_nxthist[IPPROTO_NONE], 19, 35);
#undef DO
}
Ejemplo n.º 26
0
Archivo: d.c Proyecto: zeotrope/j7-src
static void dwr(A w){if(w){C*p=CAV(w); DO(AN(w), jputc(p[i]));}}
Ejemplo n.º 27
0
static void
domode(struct ip6stat *ret)
{
	const struct ip6stat *sub;
	int divisor = 1, i;

	switch(currentmode) {
	case display_RATE:
		sub = &oldstat;
		divisor = (delay > 1000000) ? delay / 1000000 : 1;
		break;
	case display_DELTA:
		sub = &oldstat;
		break;
	case display_SINCE:
		sub = &initstat;
		break;
	default:
		*ret = curstat;
		return;
	}
#define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
	DO(ip6s_total);
	DO(ip6s_tooshort);
	DO(ip6s_toosmall);
	DO(ip6s_fragments);
	DO(ip6s_fragdropped);
	DO(ip6s_fragtimeout);
	DO(ip6s_fragoverflow);
	DO(ip6s_atomicfrags);
	DO(ip6s_forward);
	DO(ip6s_cantforward);
	DO(ip6s_redirectsent);
	DO(ip6s_delivered);
	DO(ip6s_localout);
	DO(ip6s_odropped);
	DO(ip6s_reassembled);
	DO(ip6s_fragmented);
	DO(ip6s_ofragments);
	DO(ip6s_cantfrag);
	DO(ip6s_badoptions);
	DO(ip6s_noroute);
	DO(ip6s_badvers);
	DO(ip6s_rawout);
	DO(ip6s_notmember);
	for (i = 0; i < 256; i++)
		DO(ip6s_nxthist[i]);
	DO(ip6s_badscope);
	DO(ip6s_sources_none);
#undef DO
}
Ejemplo n.º 28
0
 static inline void     endInput(const uint8_t *p)                      { DO(gCallback->endInput(p));      }
Ejemplo n.º 29
0
int main(int argc, char* argv[])
{
    for (int i = 1; i < argc; i++)
    {
        if (argv[i] == NULL) continue;
        if (strncmp(argv[i], "-r", 2) == 0 || strncmp(argv[i], "--replace", 9) == 0)
            allow_replace = true;
        else if (strncmp(argv[i], "-l", 2) == 0 || strncmp(argv[i], "--local", 7) == 0)
            local = true;
        else if (strncmp(argv[i], "-f", 2) == 0 || strncmp(argv[i], "--fetch", 7) == 0)
            do_fetch = true;
        else if (strncmp(argv[i], "-s", 2) == 0 || strncmp(argv[i], "--sql", 5) == 0)
            do_sql = true;
        else if (strncmp(argv[i], "--branch=", 9) == 0)
            snprintf(remote_branch, MAX_REMOTE, "%s", argv[i] + 9);
        else if (strncmp(argv[i], "-h", 2) == 0 || strncmp(argv[i], "--help", 6) == 0)
        {
            printf("Usage: git_id [OPTION]\n");
            printf("Generates a new rev number and updates sd2_revision_nr.h and the commit message.\n");
            printf("Should be used just before push.\n");
            printf("   -h, --help            show the usage\n");
            printf("   -r, --replace         replace the rev number if it was already applied\n");
            printf("                         to the last commit\n");
            printf("   -l, --local           search for the highest rev number on HEAD\n");
            printf("   -f, --fetch           fetch from origin before searching for the new rev\n");
            printf("   -s, --sql             search for new sql updates and do all of the changes\n");
            printf("                         for the new rev\n");
            printf("       --branch=BRANCH   specify which remote branch to use\n");
            return 0;
        }
    }

    if (local && do_sql)
    {
        printf("Options -l/--local and -s/--sql can't be used in same time currently.\n");
        printf("FAILED\n");
        return 1;
    }

    DO(find_path());
    if (!local)
    {
        DO(find_origin());
        if (do_fetch)
            DO(fetch_origin());
        DO(check_fwd());
    }
    DO(find_rev());
    DO(find_head_msg());
    if (do_sql)
        DO(find_sql_updates());
    DO(prepare_new_index());
    DO(write_rev_nr());
    if (do_sql)
    {
        DO(convert_sql_updates());
        if (generate_makefile)
            DO(generate_sql_makefile());
        // DO( change_sql_database()       ); // Currently not supported
        DO(write_rev_sql());
    }
    DO(amend_commit());
    DO(cleanup_new_index());
    // if(do_sql)
    //    DO( change_sql_history()        );

    return 0;
}
Ejemplo n.º 30
0
 static inline void   startBlock(const uint8_t *p)                      { DO(gCallback->startBlock(p));    }