TEST(TCPResegmentation, Generic) { const char* filenames[] = {"./pcaps/tcp_resegment/http_ip_fragmented_out_of_order.pcap", "./pcaps/tcp_resegment/http_ip_fragmented.pcap", "./pcaps/tcp_resegment/http_no_syn.pcap", "./pcaps/tcp_resegment/http_no_syn_synack_ack.pcap", "./pcaps/tcp_resegment/http_out_of_order_1.pcap", "./pcaps/tcp_resegment/http_out_of_order_2.pcap", "./pcaps/tcp_resegment/http_seq_num_wrapping_out_of_order.pcap", "./pcaps/tcp_resegment/http_seq_num_wrapping.pcap",}; uint expected_http_packets[] = {8, 8, 8, 3, 9, 5, 6, 8}; uint expected_http_packets_without_reordering[] = {8, 8, 8, 8, 9, 6, 7, 8}; size_t numtests = sizeof(expected_http_packets) / sizeof(expected_http_packets[0]); for(size_t i = 0; i < numtests; i++){ std::vector<uint> protocols; pfwl_state* state = pfwl_init(); getProtocols(filenames[i], protocols, state); EXPECT_EQ(protocols[PFWL_PROTO_L7_HTTP], expected_http_packets[i]); pfwl_terminate(state); } for(size_t i = 0; i < numtests; i++){ std::vector<uint> protocols; pfwl_state* state = pfwl_init(); pfwl_tcp_reordering_disable(state); getProtocols(filenames[i], protocols, state); EXPECT_EQ(protocols[PFWL_PROTO_L7_HTTP], expected_http_packets_without_reordering[i]); pfwl_terminate(state); } }
TEST(MoneroTest, Generic) { std::vector<uint> protocols; getProtocols("./pcaps/monero.pcap", protocols); EXPECT_EQ(protocols[PFWL_PROTO_L7_JSON_RPC], (uint) 142); EXPECT_TRUE(protocols[PFWL_PROTO_L7_MONERO] == (uint) 142); }
TEST(SSHTest, Generic) { std::vector<uint> protocols; getProtocols("./pcaps/ssh.cap", protocols); EXPECT_EQ(protocols[PFWL_PROTO_L7_SSH], (uint) 86); }
TEST(StratumTest, Generic) { std::vector<uint> protocols; getProtocols("./pcaps/stratum.pcap", protocols); EXPECT_EQ(protocols[PFWL_PROTO_L7_JSON_RPC], (uint) 313); EXPECT_EQ(protocols[PFWL_PROTO_L7_STRATUM], (uint) 313); }
TEST(HangoutTest, Generic) { std::vector<uint> protocols; getProtocols("./pcaps/hangout.pcap", protocols); EXPECT_EQ(protocols[PFWL_PROTO_L7_HANGOUT], (uint) 100); }
void Client::manage(Boolean mapped) { Boolean shouldHide, reshape; XWMHints *hints; Display *d = display(); long mSize; int state; XSelectInput(d, m_window, ColormapChangeMask | EnterWindowMask | PropertyChangeMask | FocusChangeMask); m_iconName = getProperty(XA_WM_ICON_NAME); m_name = getProperty(XA_WM_NAME); setLabel(); getColormaps(); getProtocols(); getTransient(); hints = XGetWMHints(d, m_window); if (!getState(&state)) { state = hints ? hints->initial_state : NormalState; } shouldHide = (state == IconicState); if (hints) XFree(hints); if (XGetWMNormalHints(d, m_window, &m_sizeHints, &mSize) == 0 || m_sizeHints.flags == 0) { m_sizeHints.flags = PSize; } m_fixedSize = False; // if ((m_sizeHints.flags & (USSize | PSize))) m_fixedSize = True; if ((m_sizeHints.flags & (PMinSize | PMaxSize)) == (PMinSize | PMaxSize) && (m_sizeHints.min_width == m_sizeHints.max_width && m_sizeHints.min_height == m_sizeHints.max_height)) m_fixedSize = True; reshape = !mapped; if (m_fixedSize) { if ((m_sizeHints.flags & USPosition)) reshape = False; if ((m_sizeHints.flags & PPosition) && shouldHide) reshape = False; if ((m_transient != None)) reshape = False; } if ((m_sizeHints.flags & PBaseSize)) { m_minWidth = m_sizeHints.base_width; m_minHeight = m_sizeHints.base_height; } else if ((m_sizeHints.flags & PMinSize)) { m_minWidth = m_sizeHints.min_width; m_minHeight = m_sizeHints.min_height; } else { m_minWidth = m_minHeight = 50; } // act gravitate(False); // zeros are iffy, should be calling some Manager method int dw = DisplayWidth(display(), 0), dh = DisplayHeight(display(), 0); if (m_w < m_minWidth) { m_w = m_minWidth; m_fixedSize = False; reshape = True; } if (m_h < m_minHeight) { m_h = m_minHeight; m_fixedSize = False; reshape = True; } if (m_w > dw - 8) m_w = dw - 8; if (m_h > dh - 8) m_h = dh - 8; if (m_x > dw - m_border->xIndent()) { m_x = dw - m_border->xIndent(); } if (m_y > dh - m_border->yIndent()) { m_y = dh - m_border->yIndent(); } if (m_x < m_border->xIndent()) m_x = m_border->xIndent(); if (m_y < m_border->yIndent()) m_y = m_border->yIndent(); m_border->configure(m_x, m_y, m_w, m_h, 0L, Above); if (mapped) m_reparenting = True; if (reshape && !m_fixedSize) XResizeWindow(d, m_window, m_w, m_h); XSetWindowBorderWidth(d, m_window, 0); m_border->reparent(); // (support for shaped windows absent) XAddToSaveSet(d, m_window); m_managed = True; if (shouldHide) hide(); else { XMapWindow(d, m_window); m_border->map(); setState(NormalState); if (CONFIG_CLICK_TO_FOCUS || (m_transient != None && activeClient() && activeClient()->m_window == m_transient)) { activate(); mapRaised(); } else { deactivate(); } } if (activeClient() && !isActive()) { activeClient()->installColormap(); } if (CONFIG_AUTO_RAISE) { m_windowManager->stopConsideringFocus(); focusIfAppropriate(False); } }