add: ;
context: static inline int lumps_len(struct sip_msg* msg, struct socket_info* send_sock){	int s_offset;	int new_len;	struct lump* t;	struct lump* r;#define SUBST_LUMP_LEN(subst_l) \		switch((subst_l)->u.subst){ \			case SUBST_RCV_IP: \				if (msg->rcv.bind_address){ \					new_len+=msg->rcv.bind_address->address_str.len; \					if (msg->rcv.bind_address->address.af!=AF_INET) \						new_len+=2; \				}else{ \					/* FIXME */ \					LOG(L_CRIT, "FIXME: null bind_address\n"); \				}; \				break; \			case SUBST_RCV_PORT: \				if (msg->rcv.bind_address){ \					new_len+=msg->rcv.bind_address->port_no_str.len; \				}else{ \					/* FIXME */ \					LOG(L_CRIT, "FIXME: null bind_address\n"); \				}; \				break; \			case SUBST_RCV_PROTO: \				if (msg->rcv.bind_address){ \					switch(msg->rcv.bind_address->proto){ \						case PROTO_NONE: \						case PROTO_UDP: \						case PROTO_TCP: \						case PROTO_TLS: \								new_len+=3; \								break; \						case PROTO_SCTP: \								new_len+=4; \								break; \						default: \						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \								msg->rcv.bind_address->proto); \					}\				}else{ \					/* FIXME */ \					LOG(L_CRIT, "FIXME: null bind_address\n"); \				}; \				break; \			case SUBST_RCV_ALL: \				if (msg->rcv.bind_address){ \					new_len+=msg->rcv.bind_address->address_str.len; \					if (msg->rcv.bind_address->address.af!=AF_INET) \						new_len+=2; \					if (msg->rcv.bind_address->port_no!=SIP_PORT){ \						/* add :port_no */ \						new_len+=1+msg->rcv.bind_address->port_no_str.len; \					}\						/*add;transport=xxx*/ \					switch(msg->rcv.bind_address->proto){ \						case PROTO_NONE: \						case PROTO_UDP: \								break; /* udp is the default */ \						case PROTO_TCP: \						case PROTO_TLS: \								new_len+=TRANSPORT_PARAM_LEN+3; \								break; \						case PROTO_SCTP: \								new_len+=TRANSPORT_PARAM_LEN+4; \								break; \						default: \						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \								msg->rcv.bind_address->proto); \					}\				}else{ \					/* FIXME */ \					LOG(L_CRIT, "FIXME: null bind_address\n"); \				}; \				break; \			case SUBST_SND_IP: \				if (send_sock){ \					new_len+=send_sock->address_str.len; \					if (send_sock->address.af!=AF_INET) \						new_len+=2; \				}else{ \					LOG(L_CRIT, "FIXME: lumps_len called with" \							" null send_sock\n"); \				}; \				break; \			case SUBST_SND_PORT: \				if (send_sock){ \					new_len+=send_sock->port_no_str.len; \				}else{ \					LOG(L_CRIT, "FIXME: lumps_len called with" \							" null send_sock\n"); \				}; \				break; \			case SUBST_SND_PROTO: \				if (send_sock){ \					switch(send_sock->proto){ \						case PROTO_NONE: \						case PROTO_UDP: \						case PROTO_TCP: \						case PROTO_TLS: \								new_len+=3; \								break; \						case PROTO_SCTP: \								new_len+=4; \								break; \						default: \						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \								send_sock->proto); \					}\				}else{ \					LOG(L_CRIT, "FIXME: lumps_len called with" \							" null send_sock\n"); \				}; \				break; \			case SUBST_SND_ALL: \				if (send_sock){ \					new_len+=send_sock->address_str.len; \					if (send_sock->address.af!=AF_INET) \						new_len+=2; \					if (send_sock->port_no!=SIP_PORT){ \						/* add :port_no */ \						new_len+=1+send_sock->port_no_str.len; \					}\					/*add;transport=xxx*/ \					switch(send_sock->proto){ \						case PROTO_NONE: \						case PROTO_UDP: \								break; /* udp is the default */ \						case PROTO_TCP: \						case PROTO_TLS: \								new_len+=TRANSPORT_PARAM_LEN+3; \								break; \						case PROTO_SCTP: \								new_len+=TRANSPORT_PARAM_LEN+4; \								break; \						default: \						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \								send_sock->proto); \					}\				}else{ \					/* FIXME */ \					LOG(L_CRIT, "FIXME: lumps_len called with" \							" null send_sock\n"); \				}; \				break; \			case SUBST_NOP: /* do nothing */ \				break; \			default: \				LOG(L_CRIT, "BUG: unknown subst type %d\n", \						(subst_l)->u.subst); \		}		s_offset=0;	new_len=0;		for(t=msg->add_rm;t;t=t->next){		/* skip if this is an OPT lump and the condition is not satisfied */		if ((t->op==LUMP_ADD_OPT) && !lump_check_opt(t->u.cond, msg, send_sock))			continue;		for(r=t->before;r;r=r->before){			switch(r->op){				case LUMP_ADD:					new_len+=r->len;					break;				case LUMP_ADD_SUBST:					SUBST_LUMP_LEN(r);					break;				case LUMP_ADD_OPT:					/* skip if this is an OPT lump and the condition is 					 * not satisfied */					if (!lump_check_opt(r->u.cond, msg, send_sock))						goto skip_before;					break;				default:					/* only ADD allowed for before/after */						LOG(L_CRIT, "BUG: lumps_len: invalid op "							"for data lump (%x)\n", r->op);			}		}skip_before:		switch(t->op){			case LUMP_ADD:				new_len+=t->len;				break;			case LUMP_ADD_SUBST:				SUBST_LUMP_LEN(t);				break;			case LUMP_ADD_OPT:				/* we don't do anything here, it's only a condition for				 * before & after */				break;			case LUMP_DEL:				/* fix overlapping deleted zones */				if (t->u.offset < s_offset){					/* change len */					if (t->len>s_offset-t->u.offset)							t->len-=s_offset-t->u.offset;					else t->len=0;					t->u.offset=s_offset;				}				s_offset=t->u.offset+t->len;				new_len-=t->len;				break;			case LUMP_NOP:				/* fix offset if overlapping on a deleted zone */				if (t->u.offset < s_offset){					t->u.offset=s_offset;				}else					s_offset=t->u.offset;				/* do nothing */				break;			default:				LOG(L_CRIT,"BUG:lumps_len: invalid"							" op for data lump (%x)\n", r->op);		}		for (r=t->after;r;r=r->after){			switch(r->op){				case LUMP_ADD:					new_len+=r->len;					break;				case LUMP_ADD_SUBST:					SUBST_LUMP_LEN(r);					break;				case LUMP_ADD_OPT:					/* skip if this is an OPT lump and the condition is 					 * not satisfied */					if (!lump_check_opt(r->u.cond, msg, send_sock))						goto skip_after;					break;				default:					/* only ADD allowed for before/after */					LOG(L_CRIT, "BUG:lumps_len: invalid"								" op for data lump (%x)\n", r->op);			}		}skip_after:	}	return new_len;}