/* Do not send an error message in response to an error message */
static inline int can_respond(struct sk_buff *skb)
{
    const struct phonethdr *ph;
    const struct phonetmsg *pm;
    u8 submsg_id;

    if (!pskb_may_pull(skb, 3))
        return 0;

    ph = pn_hdr(skb);
    if (ph->pn_res == PN_PREFIX && !pskb_may_pull(skb, 5))
        return 0;
    if (ph->pn_res == PN_COMMGR) /* indications */
        return 0;

    ph = pn_hdr(skb); /* re-acquires the pointer */
    pm = pn_msg(skb);
    if (pm->pn_msg_id != PN_COMMON_MESSAGE)
        return 1;
    submsg_id = (ph->pn_res == PN_PREFIX)
                ? pm->pn_e_submsg_id : pm->pn_submsg_id;
    if (submsg_id != PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP &&
            pm->pn_e_submsg_id != PN_COMM_SERVICE_NOT_IDENTIFIED_RESP)
        return 1;
    return 0;
}
Example #2
0
void message::encode(std::vector<char> &s) const {
    impl().flush();
    size_t sz = std::max(s.capacity(), size_t(512));
    while (true) {
        s.resize(sz);
        assert(!s.empty());
        int err = pn_message_encode(pn_msg(), const_cast<char*>(&s[0]), &sz);
        if (err) {
            if (err != PN_OVERFLOW)
                check(err);
        } else {
            s.resize(sz);
            return;
        }
        sz *= 2;
    }
}
Example #3
0
static int send_obj_unreachable(struct sk_buff *rskb)
{
	const struct phonethdr *oph = pn_hdr(rskb);
	const struct phonetmsg *opm = pn_msg(rskb);
	struct phonetmsg resp;

	memset(&resp, 0, sizeof(resp));
	resp.pn_trans_id = opm->pn_trans_id;
	resp.pn_msg_id = PN_COMMON_MESSAGE;
	if (oph->pn_res == PN_PREFIX) {
		resp.pn_e_res_id = opm->pn_e_res_id;
		resp.pn_e_submsg_id = PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP;
		resp.pn_e_orig_msg_id = opm->pn_msg_id;
		resp.pn_e_status = 0;
	} else {
		resp.pn_submsg_id = PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP;
		res
Example #4
0
void message::durable(bool b) { pn_message_set_durable(pn_msg(), b); }
Example #5
0
bool message::durable() const { return pn_message_is_durable(pn_msg()); }
Example #6
0
message_id message::correlation_id() const {
    return pn_message_get_correlation_id(pn_msg());
}
Example #7
0
int32_t message::group_sequence() const { return pn_message_get_group_sequence(pn_msg()); }
Example #8
0
uint32_t message::delivery_count() const { return pn_message_get_delivery_count(pn_msg()); }
Example #9
0
bool message::first_acquirer() const { return pn_message_is_first_acquirer(pn_msg()); }
Example #10
0
uint8_t message::priority() const { return pn_message_get_priority(pn_msg()); }
Example #11
0
void message::reply_to_group_id(const std::string &s) {
    check(pn_message_set_reply_to_group_id(pn_msg(), s.c_str()));
}
Example #12
0
timestamp message::creation_time() const {
    return timestamp(pn_message_get_creation_time(pn_msg()));
}
Example #13
0
void message::creation_time(timestamp t) {
    pn_message_set_creation_time(pn_msg(), t.milliseconds());
}
Example #14
0
timestamp message::expiry_time() const {
    return timestamp(pn_message_get_expiry_time(pn_msg()));
}
Example #15
0
void message::expiry_time(timestamp t) {
    pn_message_set_expiry_time(pn_msg(), t.milliseconds());
}
Example #16
0
std::string message::content_encoding() const {
    const char* s = pn_message_get_content_encoding(pn_msg());
    return s ? std::string(s) : std::string();
}
Example #17
0
void message::content_encoding(const std::string &s) {
    check(pn_message_set_content_encoding(pn_msg(), s.c_str()));
}
Example #18
0
duration message::ttl() const { return duration(pn_message_get_ttl(pn_msg())); }
Example #19
0
void message::ttl(duration d) { pn_message_set_ttl(pn_msg(), d.milliseconds()); }
Example #20
0
std::string message::reply_to_group_id() const {
    const char* s = pn_message_get_reply_to_group_id(pn_msg());
    return s ? std::string(s) : std::string();
}
Example #21
0
void message::priority(uint8_t d) { pn_message_set_priority(pn_msg(), d); }
Example #22
0
bool message::inferred() const { return pn_message_is_inferred(pn_msg()); }
Example #23
0
void message::first_acquirer(bool b) { pn_message_set_first_acquirer(pn_msg(), b); }
Example #24
0
void message::inferred(bool b) { pn_message_set_inferred(pn_msg(), b); }
Example #25
0
void message::delivery_count(uint32_t d) { pn_message_set_delivery_count(pn_msg(), d); }
Example #26
0
std::string message::subject() const {
    const char* s = pn_message_get_subject(pn_msg());
    return s ? std::string(s) : std::string();
}
Example #27
0
void message::group_sequence(int32_t d) { pn_message_set_group_sequence(pn_msg(), d); }
Example #28
0
void message::correlation_id(const message_id& id) {
    value(pn_message_correlation_id(pn_msg())) = id;
}
Example #29
0
void message::decode(const std::vector<char> &s) {
    if (s.empty())
        throw error("message decode: no data");
    impl().clear();
    check(pn_message_decode(pn_msg(), &s[0], s.size()));
}
Example #30
0
void message::subject(const std::string &s) {
    check(pn_message_set_subject(pn_msg(), s.c_str()));
}