struct init_params* params_new(void) { struct init_params *params = (struct init_params *) malloc(sizeof(struct init_params)); bzero(params, sizeof(struct init_params)); params->client_buffer = data_new(); params->connections = connections_new(); params->packets_receive = packets_new(); params->packets_send = packets_new(); return params; }
struct state *state_new(struct config *config, struct script *script, struct netdev *netdev) { struct state *state = calloc(1, sizeof(struct state)); if (pthread_mutex_init(&state->mutex, NULL) != 0) die_perror("pthread_mutex_init"); run_lock(state); state->config = config; state->script = script; state->netdev = netdev; state->packets = packets_new(); state->syscalls = syscalls_new(state); state->code = code_new(config); state->sockets = NULL; return state; }