/* * This callback responds to PMTU requests, too. It * returns 0 only for teardowns. */ int keepalive_cb(struct tunsess *tun) { if (!ts_verify_packet(tun)) return 0; switch (P_TYPE(tun->inbuf)) { case PACKET_KEEPALIVE: debug("received KEEPALIVE\n"); break; case PACKET_PMTUD: debug("received PMTUD with size %d\n", tun->inlen); ts_compose_packet(tun, PACKET_PMTUD_ACK, "w", tun->inlen); ts_send_packet(tun); debug("sent PMTUD ACK\n"); break; case PACKET_PMTUD_ACK: debug("received PMTUD ACK\n"); break; case PACKET_ERROR: debug("received teardown request\n"); return 0; break; default: debug("received unexpected packet of size %d\n", tun->inlen); dump_packet(tun->inbuf, tun->inlen); } return -1; }
int tunnel_cb(struct tunsess *tun) { if (P_TYPE(tun->inbuf) == PACKET_TUNNEL) { tun->remote_tunid = ntohl(*(uint32_t *)P_DATA(tun->inbuf)); debug("received TUNNEL. Remote tunnel ID is %d.\n", tun->remote_tunid); return 0; } else return -1; }
int cookie_cb(struct tunsess *tun) { if (P_TYPE(tun->inbuf) == PACKET_COOKIE) { debug("received COOKIE 0x%16lx\n", *(uint64_t *)P_DATA(tun->inbuf)); memcpy(tun->cookie, P_DATA(tun->inbuf), 8); tun->cookie[8] = 0; return 0; } else { return -1; } }
.dt = 0.008, .verbosity = 5, .gconst = 0, .algorithm = strdup("none"), .thread_schedule_mode = strdup("SCHED_RR"), .custom_sprite_png = NULL, .step_back_buffer = 0, /* Physics - ctrl */ .dump_xyz = 0, .xyz_temp = strdup("system_%0.2Lf.xyz"), }; /* Default settings. */ /* Register parser options */ struct parser_map opts_map[] = { {"threads", P_TYPE(option->threads) }, {"dt", P_TYPE(option->dt) }, {"final_frame", P_TYPE(option->final_frame) }, {"rng_seed", P_TYPE(option->rng_seed) }, {"gconst", P_TYPE(option->gconst) }, {"verbosity", P_TYPE(option->verbosity) }, {"step_back_buffer", P_TYPE(option->step_back_buffer) }, {"dump_xyz", P_TYPE(option->dump_xyz) }, {"exec_funct_freq", P_TYPE(option->exec_funct_freq) }, {"default_draw_mode", P_TYPE(option->default_draw_mode) }, {"lua_gc_sweep_freq", P_TYPE(option->lua_gc_sweep_freq) }, {"skip_model_vec", P_TYPE(option->skip_model_vec) }, {"algorithm", P_TYPE(option->algorithm) }, {"spawn_funct", P_TYPE(option->spawn_funct) }, {"timestep_funct", P_TYPE(option->timestep_funct) }, {"file_template", P_TYPE(option->xyz_temp) },