import peers.sip.syntaxencoding.SipHeaderFieldName;
import peers.sip.syntaxencoding.SipHeaderFieldValue;
import peers.sip.syntaxencoding.SipHeaders;

public class common {

    public static boolean ValidString(String value){
        if (value!=null){
            return !value.isEmpty();
        }
        return false;
    }

    public static boolean ValidPortNumber(int value){
        return value>0 && value<65536;
    }

    public static String GetSIPHeaderValue(SipHeaders head, String headername) {
        if (head!=null) {
            SipHeaderFieldName _fn = new SipHeaderFieldName(headername);
            if (head.contains(_fn)) {
                SipHeaderFieldValue _fv = head.get(_fn);
                if (_fv!=null) {
                    return _fv.getValue();
                }
            }
        }
        return null;
    }
}
