int do_download(struct sftp_conn *conn, char *remote_path, char *local_path, int pflag) { Attrib junk, *a; Buffer msg; char *handle; int local_fd, status, num_req, max_req, write_error; int read_error, write_errno; u_int64_t offset, size; u_int handle_len, mode, type, id, buflen; struct request { u_int id; u_int len; u_int64_t offset; TAILQ_ENTRY(request) tq; };
void levent_ctl_notify(char *ifname, int state, struct lldpd_port *neighbor) { struct lldpd_one_client *client, *client_next; struct lldpd_neighbor_change neigh = { .ifname = ifname, .state = state, .neighbor = neighbor }; void *output = NULL; ssize_t output_len = 0; /* Don't use TAILQ_FOREACH, the client may be deleted in case of errors. */ log_debug("control", "notify clients of neighbor changes"); for (client = TAILQ_FIRST(&lldpd_clients); client; client = client_next) { client_next = TAILQ_NEXT(client, next); if (!client->subscribed) continue; if (output == NULL) { /* Ugly hack: we don't want to transmit a list of * ports. We patch the port to avoid this. */ TAILQ_ENTRY(lldpd_port) backup_p_entries; memcpy(&backup_p_entries, &neighbor->p_entries, sizeof(backup_p_entries)); memset(&neighbor->p_entries, 0, sizeof(backup_p_entries)); output_len = marshal_serialize(lldpd_neighbor_change, &neigh, &output); memcpy(&neighbor->p_entries, &backup_p_entries, sizeof(backup_p_entries)); if (output_len <= 0) { log_warnx("event", "unable to serialize changed neighbor"); return; } } levent_ctl_send(client, NOTIFICATION, output, output_len); } free(output); }