restructered sr_ip.c