/*
 * Automatically generated by jrpcgen 1.0.5 on 4/21/25, 8:49 PM
 * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
 * See http://acplt.org/ks/remotetea.html for details
 */
import org.acplt.oncrpc.*;
import java.io.IOException;

import java.net.InetAddress;

import org.acplt.oncrpc.server.*;

/**
 */
public abstract class CalculServerStub extends OncRpcServerStub implements OncRpcDispatchable {

    public CalculServerStub()
           throws OncRpcException, IOException {
        this(0);
    }

    public CalculServerStub(int port)
           throws OncRpcException, IOException {
        this(null, port);
    }

    public CalculServerStub(InetAddress bindAddr, int port)
           throws OncRpcException, IOException {
        info = new OncRpcServerTransportRegistrationInfo [] {
            new OncRpcServerTransportRegistrationInfo(Calcul.CALCUL_PROG, 1),
            new OncRpcServerTransportRegistrationInfo(Calcul.CALCUL_PROG, 2),
        };
        transports = new OncRpcServerTransport [] {
            new OncRpcUdpServerTransport(this, bindAddr, port, info, 32768),
            new OncRpcTcpServerTransport(this, bindAddr, port, info, 32768)
        };
    }

    public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure)
           throws OncRpcException, IOException {
        if ( version == 1 ) {
            switch ( procedure ) {
            case 0: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                calcul_null_1();
                call.reply(XdrVoid.XDR_VOID);
                break;
            }
            case 1: {
                class XdrAble$ implements XdrAble {
                    public int a;
                    public int b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeInt();
                        b = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrInt result$ = new XdrInt(add_1(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 2: {
                class XdrAble$ implements XdrAble {
                    public int a;
                    public int b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeInt();
                        b = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrInt result$ = new XdrInt(sub_1(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 3: {
                class XdrAble$ implements XdrAble {
                    public int a;
                    public int b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeInt();
                        b = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrInt result$ = new XdrInt(mul_1(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 4: {
                class XdrAble$ implements XdrAble {
                    public int a;
                    public int b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeInt();
                        b = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrInt result$ = new XdrInt(div_1(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 5: {
                class XdrAble$ implements XdrAble {
                    public int a;
                    public int b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeInt();
                        b = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrInt result$ = new XdrInt(mod_1(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            default:
                call.failProcedureUnavailable();
            }
        } else if ( version == 2 ) {
            switch ( procedure ) {
            case 0: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                calcul_null_2();
                call.reply(XdrVoid.XDR_VOID);
                break;
            }
            case 1: {
                class XdrAble$ implements XdrAble {
                    public float a;
                    public float b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeFloat();
                        b = xdr.xdrDecodeFloat();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrFloat result$ = new XdrFloat(add_2(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 2: {
                class XdrAble$ implements XdrAble {
                    public float a;
                    public float b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeFloat();
                        b = xdr.xdrDecodeFloat();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrFloat result$ = new XdrFloat(sub_2(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 3: {
                class XdrAble$ implements XdrAble {
                    public float a;
                    public float b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeFloat();
                        b = xdr.xdrDecodeFloat();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrFloat result$ = new XdrFloat(mul_2(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            case 4: {
                class XdrAble$ implements XdrAble {
                    public float a;
                    public float b;
                    public void xdrEncode(XdrEncodingStream xdr)
                        throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                        throws OncRpcException, IOException {
                        a = xdr.xdrDecodeFloat();
                        b = xdr.xdrDecodeFloat();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrFloat result$ = new XdrFloat(div_2(args$.a, args$.b));
                call.reply(result$);
                break;
            }
            default:
                call.failProcedureUnavailable();
            }
        } else {
            call.failProcedureUnavailable();
        }
    }

    public abstract void calcul_null_1();

    public abstract int add_1(int a, int b);

    public abstract int sub_1(int a, int b);

    public abstract int mul_1(int a, int b);

    public abstract int div_1(int a, int b);

    public abstract int mod_1(int a, int b);

    public abstract void calcul_null_2();

    public abstract float add_2(float a, float b);

    public abstract float sub_2(float a, float b);

    public abstract float mul_2(float a, float b);

    public abstract float div_2(float a, float b);

}
// End of CalculServerStub.java
