Example #1
0
        /**
         * Creates an ErrorCodeAttribute with the specified error class, number and
         * reason phrase.
         * @param errorClass a valid error class.
         * @param errorNumber a valid error number.
         * @param reasonPhrase a human readable reason phrase. A null reason phrase
         *                     would be replaced (if possible) by a default one
         *                     as defined byte the rfc3489.
         * @return the newly created attribute.
         * @throws StunException if the error class or number have invalid values
         * according to rfc3489.
         */
        public static ErrorCodeAttribute CreateErrorCodeAttribute(
            int errorClass,
            int errorNumber,
            String reasonPhrase
            )
        {
            ErrorCodeAttribute attribute = new ErrorCodeAttribute();

            attribute.SetErrorClass(errorClass);
            attribute.SetErrorNumber(errorNumber);

            attribute.SetReasonPhrase(reasonPhrase == null?
                                      ErrorCodeAttribute.GetDefaultReasonPhrase(attribute.GetErrorCode())
                                :reasonPhrase);

            return(attribute);
        }
Example #2
0
        /**
         * Creates an ErrorCodeAttribute with the specified error class, number and
         * reason phrase.
         * @param errorClass a valid error class.
         * @param errorNumber a valid error number.
         * @param reasonPhrase a human readable reason phrase. A null reason phrase
         *                     would be replaced (if possible) by a default one
         *                     as defined byte the rfc3489.
         * @return the newly created attribute.
         * @throws StunException if the error class or number have invalid values
         * according to rfc3489.
         */
        public static ErrorCodeAttribute CreateErrorCodeAttribute(
			int errorClass,
			int errorNumber,
			String reasonPhrase
			)
        {
            ErrorCodeAttribute attribute = new ErrorCodeAttribute();

            attribute.SetErrorClass(errorClass);
            attribute.SetErrorNumber(errorNumber);

            attribute.SetReasonPhrase(reasonPhrase==null?
                ErrorCodeAttribute.GetDefaultReasonPhrase(attribute.GetErrorCode())
                :reasonPhrase);

            return attribute;
        }