Пример #1
0
 internal static RpcException ProcedureUnavalible(reply_body replyBody)
 {
     return(new ReplyException(replyBody, "program can't support procedure"));
 }
Пример #2
0
 internal static ReplyException ProgramMismatch(reply_body replyBody, mismatch_info info)
 {
     return(new ReplyException(replyBody,
                               string.Format("remote can't support program version (supported versions of between {0} and {1})", info.low, info.high)));
 }
Пример #3
0
 internal static ReplyException ProgramUnavalible(reply_body replyBody)
 {
     return(new ReplyException(replyBody, "remote hasn't exported program"));
 }
Пример #4
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 public AuthenticateException(reply_body replyBody)
     : base(replyBody)
 {
 }
Пример #5
0
 internal static ReplyException RpcVersionError(reply_body replyBody, mismatch_info info)
 {
     return(new ReplyException(replyBody,
                               string.Format("unsupported RPC version number (supported versions of between {0} and {1})", info.low, info.high)));
 }
Пример #6
0
 internal static ReplyException ProgramMismatch(reply_body replyBody, mismatch_info info)
 {
     return new ReplyException(replyBody,
         string.Format("remote can't support program version (supported versions of between {0} and {1})", info.low, info.high));
 }
Пример #7
0
 internal static ReplyException RpcVersionError(reply_body replyBody, mismatch_info info)
 {
     return new ReplyException(replyBody,
         string.Format("unsupported RPC version number (supported versions of between {0} and {1})", info.low, info.high));
 }
Пример #8
0
 /// <summary>
 /// Error received in response RPC message
 /// </summary>
 /// <param name="replyBody"></param>
 public ReplyException(reply_body replyBody)
 {
     ReplyBody = replyBody;
 }
Пример #9
0
 /// <summary>
 /// Error received in response RPC message
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 public ReplyException(reply_body replyBody, string message)
     : base(message)
 {
     ReplyBody = replyBody;
 }
Пример #10
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 public AuthenticateException(reply_body replyBody, string message)
     : base(replyBody, message)
 {
 }
Пример #11
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 /// <param name="innerEx"></param>
 public AuthenticateException(reply_body replyBody, string message, Exception innerEx)
     : base(replyBody, message, innerEx)
 {
 }
Пример #12
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 public AuthenticateException(reply_body replyBody)
     : base(replyBody)
 {
 }
Пример #13
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 /// <param name="innerEx"></param>
 public AuthenticateException(reply_body replyBody, string message, Exception innerEx)
     : base(replyBody, message, innerEx)
 {
 }
Пример #14
0
 /// <summary>
 /// Authenticate error
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 public AuthenticateException(reply_body replyBody, string message)
     : base(replyBody, message)
 {
 }
Пример #15
0
 internal static AuthenticateException AuthError(reply_body replyBody, auth_stat state)
 {
     return new AuthenticateException(replyBody, GetAuthDescription(state));
 }
Пример #16
0
 /// <summary>
 /// Error received in response RPC message
 /// </summary>
 /// <param name="replyBody"></param>
 /// <param name="message"></param>
 /// <param name="innerEx"></param>
 public ReplyException(reply_body replyBody, string message, Exception innerEx)
     : base(message, innerEx)
 {
     ReplyBody = replyBody;
 }
Пример #17
0
 internal static RpcException ProcedureUnavalible(reply_body replyBody)
 {
     return new ReplyException(replyBody, "program can't support procedure");
 }
Пример #18
0
 internal static ReplyException SystemError(reply_body replyBody)
 {
     return(new ReplyException(replyBody, "system error in RPC-server"));
 }
Пример #19
0
 internal static ReplyException ProgramUnavalible(reply_body replyBody)
 {
     return new ReplyException(replyBody, "remote hasn't exported program");
 }
Пример #20
0
 internal static AuthenticateException AuthError(reply_body replyBody, auth_stat state)
 {
     return(new AuthenticateException(replyBody, GetAuthDescription(state)));
 }
Пример #21
0
 internal static ReplyException SystemError(reply_body replyBody)
 {
     return new ReplyException(replyBody, "system error in RPC-server");
 }
Пример #22
0
        /// <summary>
        /// returns the description of the RPC message
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static void ReplyMessageValidate(rpc_msg msg)
        {
            try
            {
                if (msg.body.mtype != msg_type.REPLY)
                {
                    throw Exceptions.UnexpectedMessageType(msg.body.mtype);
                }

                reply_body replyBody = msg.body.rbody;

                if (replyBody.stat == reply_stat.MSG_ACCEPTED)
                {
                    accepted_reply.reply_data_union du = replyBody.areply.reply_data;
                    switch (du.stat)
                    {
                    case accept_stat.GARBAGE_ARGS:
                        throw Exceptions.GarbageArgs();

                    case accept_stat.PROC_UNAVAIL:
                        throw Exceptions.ProcedureUnavalible(replyBody);

                    case accept_stat.PROG_MISMATCH:
                        throw Exceptions.ProgramMismatch(replyBody, du.mismatch_info);

                    case accept_stat.PROG_UNAVAIL:
                        throw Exceptions.ProgramUnavalible(replyBody);

                    case accept_stat.SUCCESS:
                        return;

                    case accept_stat.SYSTEM_ERR:
                        throw Exceptions.SystemError(replyBody);

                    default:
                        throw Exceptions.NoRFC5531("msg");
                    }
                }

                if (replyBody.stat == reply_stat.MSG_DENIED)
                {
                    if (replyBody.rreply.rstat == reject_stat.AUTH_ERROR)
                    {
                        throw Exceptions.AuthError(replyBody, replyBody.rreply.astat);
                    }
                    else if (replyBody.rreply.rstat == reject_stat.RPC_MISMATCH)
                    {
                        throw Exceptions.RpcVersionError(replyBody, replyBody.rreply.mismatch_info);
                    }
                    else
                    {
                        throw Exceptions.NoRFC5531("msg");
                    }
                }

                throw Exceptions.NoRFC5531("msg");
            }
            catch (NullReferenceException)
            {
                throw Exceptions.NoRFC5531("msg");
            }
        }