Beispiel #1
0
netsnmp_transport *mei_udp_transport(netsnmp_tdomain* domain, struct sockaddr_storage* addr, int local) {
    Stream* stream = new Stream();
    if(NULL == stream) {
        return NULL;
    }

    netsnmp_transport *t = stream->transport();

    /*
     * Set Domain
     */
    t->domain = domain->name;
    t->domain_length = domain->name_length;

    if(AF_INET == addr->ss_family) {
        init4(t, (struct sockaddr_in*)addr, local);
    } else {
        init6(t, (struct sockaddr_in6*)addr, local);
    }

    /*
     * 16-bit length field, 8 byte UDP header, 20 byte IPv4 header
     */

    t->msgMaxSize = 0xffff - 8 - 20;

    return t;
}
Beispiel #2
0
//#define _SUBR		0x06	// 引数評価・C
//#define _EXPR		0x04	// 引数評価
//#define _FSUBR	0x02	// 引数評価しない・C
// 組み込み関数の登録
void init_subr()
{
	init0();
	init1();
	init2();
	init3();
	init4();
}
Beispiel #3
0
int initCerebellum() {
  cerebSerial = new serialPort();

  init4(); //call 'init 4' so that I can use the serial port
  int tries;
  for(tries=0; cerebSerial->Open("/dev/ttyS0") < 0 && tries < 3; tries++)
    usleep(100000);
  if(tries >= 3) {
    printf("Couldn't open the serial port for the cerebellum!\n");
    FILE *error = fopen("/root/error.txt", "w");
    fprintf(error, "Couldn't open the serial port for the cerebellum!\n");
    fclose(error);
    return 1;
  }
  return 0;
}
    test* getOneofTestInstance()
    {
        test *t = new test;
        ScopeExitGuard onSuccessRollback([&] { delete t; t = NULL; });

        if(!init1(t))     // init1 failure
            return NULL;  // 直接return,t 会自动析构
        if(!init2(t))     // init2 failure
            return NULL;
        if(!init3(t) || !init4(t))  // init3 or init4 failure
            return NULL;

        // now t must be available
        onSuccessRollback.dismiss(); // dismiss, t不会析构,直接返回
        return t;
    }
Beispiel #5
0
Segment4::Segment4(glm::vec4& startVertex, glm::vec4& midVertex, glm::vec4& endVertex, glm::vec4& lastVertex) : Segment3(startVertex, midVertex, endVertex) {
	this->lastVertex = lastVertex;
	init4();
}