Lines Matching refs:mtcp

12 void flush_log_data(mtcp_manager_t mtcp)  in flush_log_data()  argument
15 if (mtcp->w_buffer) { in flush_log_data()
16 EnqueueJobBuffer(mtcp->logger, mtcp->w_buffer); in flush_log_data()
17 ret = write(mtcp->sp_fd, "A", 1); in flush_log_data()
26 thread_printf(mtcp_manager_t mtcp, FILE* f_idx, const char* _Format, ...) in thread_printf() argument
37 pthread_mutex_lock(&mtcp->logger->mutex); in thread_printf()
38 wbuf = mtcp->w_buffer; in thread_printf()
40 flush_log_data(mtcp); in thread_printf()
46 wbuf = DequeueFreeBuffer(mtcp->logger); in thread_printf()
50 wbuf->tid = mtcp->ctx->cpu; in thread_printf()
52 mtcp->w_buffer = wbuf; in thread_printf()
57 pthread_mutex_unlock(&mtcp->logger->mutex); in thread_printf()
64 DumpPacket(mtcp_manager_t mtcp, char *buf, int len, char *step, int ifindex) in DumpPacket() argument
73 thread_printf(mtcp, mtcp->log_fp, "%s %d %u", step, ifindex, mtcp->cur_ts); in DumpPacket()
75 thread_printf(mtcp, mtcp->log_fp, "%s ? %u", step, mtcp->cur_ts); in DumpPacket()
79 …thread_printf(mtcp, mtcp->log_fp, "%02X:%02X:%02X:%02X:%02X:%02X -> %02X:%02X:%02X:%02X:%02X:%02X … in DumpPacket()
93 thread_printf(mtcp, mtcp->log_fp, "protocol %04hx ", ntohs(ethh->h_proto)); in DumpPacket()
97 thread_printf(mtcp, mtcp->log_fp, " "); in DumpPacket()
104 thread_printf(mtcp, mtcp->log_fp, "%u.%u.%u.%u", t[0], t[1], t[2], t[3]); in DumpPacket()
106 thread_printf(mtcp, mtcp->log_fp, "(%d)", ntohs(udph->source)); in DumpPacket()
108 thread_printf(mtcp, mtcp->log_fp, " -> "); in DumpPacket()
111 thread_printf(mtcp, mtcp->log_fp, "%u.%u.%u.%u", t[0], t[1], t[2], t[3]); in DumpPacket()
113 thread_printf(mtcp, mtcp->log_fp, "(%d)", ntohs(udph->dest)); in DumpPacket()
115 thread_printf(mtcp, mtcp->log_fp, " IP_ID=%d", ntohs(iph->id)); in DumpPacket()
116 thread_printf(mtcp, mtcp->log_fp, " TTL=%d ", iph->ttl); in DumpPacket()
124 thread_printf(mtcp, mtcp->log_fp, "(bad checksum %04x should be %04x) ", in DumpPacket()
131 thread_printf(mtcp, mtcp->log_fp, "TCP "); in DumpPacket()
134 thread_printf(mtcp, mtcp->log_fp, "S "); in DumpPacket()
136 thread_printf(mtcp, mtcp->log_fp, "F "); in DumpPacket()
138 thread_printf(mtcp, mtcp->log_fp, "A "); in DumpPacket()
140 thread_printf(mtcp, mtcp->log_fp, "R "); in DumpPacket()
142 thread_printf(mtcp, mtcp->log_fp, "seq %u ", ntohl(tcph->seq)); in DumpPacket()
144 thread_printf(mtcp, mtcp->log_fp, "ack %u ", ntohl(tcph->ack_seq)); in DumpPacket()
145 thread_printf(mtcp, mtcp->log_fp, "WDW=%u ", ntohs(tcph->window)); in DumpPacket()
148 thread_printf(mtcp, mtcp->log_fp, "UDP "); in DumpPacket()
151 thread_printf(mtcp, mtcp->log_fp, "protocol %d ", iph->protocol); in DumpPacket()
155 thread_printf(mtcp, mtcp->log_fp, "len=%d\n", len); in DumpPacket()
159 DumpIPPacket(mtcp_manager_t mtcp, const struct iphdr *iph, int len) in DumpIPPacket() argument
169 thread_printf(mtcp, mtcp->log_fp, "%u.%u.%u.%u", t[0], t[1], t[2], t[3]); in DumpIPPacket()
171 thread_printf(mtcp, mtcp->log_fp, "(%d)", ntohs(udph->source)); in DumpIPPacket()
173 thread_printf(mtcp, mtcp->log_fp, " -> "); in DumpIPPacket()
176 thread_printf(mtcp, mtcp->log_fp, "%u.%u.%u.%u", t[0], t[1], t[2], t[3]); in DumpIPPacket()
178 thread_printf(mtcp, mtcp->log_fp, "(%d)", ntohs(udph->dest)); in DumpIPPacket()
180 thread_printf(mtcp, mtcp->log_fp, " IP_ID=%d", ntohs(iph->id)); in DumpIPPacket()
181 thread_printf(mtcp, mtcp->log_fp, " TTL=%d ", iph->ttl); in DumpIPPacket()
184 thread_printf(mtcp, mtcp->log_fp, "(bad checksum) "); in DumpIPPacket()
189 thread_printf(mtcp, mtcp->log_fp, "TCP "); in DumpIPPacket()
192 thread_printf(mtcp, mtcp->log_fp, "S "); in DumpIPPacket()
194 thread_printf(mtcp, mtcp->log_fp, "F "); in DumpIPPacket()
196 thread_printf(mtcp, mtcp->log_fp, "A "); in DumpIPPacket()
198 thread_printf(mtcp, mtcp->log_fp, "R "); in DumpIPPacket()
200 thread_printf(mtcp, mtcp->log_fp, "seq %u ", ntohl(tcph->seq)); in DumpIPPacket()
202 thread_printf(mtcp, mtcp->log_fp, "ack %u ", ntohl(tcph->ack_seq)); in DumpIPPacket()
203 thread_printf(mtcp, mtcp->log_fp, "WDW=%u ", ntohs(tcph->window)); in DumpIPPacket()
206 thread_printf(mtcp, mtcp->log_fp, "UDP "); in DumpIPPacket()
209 thread_printf(mtcp, mtcp->log_fp, "protocol %d ", iph->protocol); in DumpIPPacket()
213 thread_printf(mtcp, mtcp->log_fp, "len=%d\n", len); in DumpIPPacket()