/* Header file for CS 3251 UDP Programming Assignment */ #define SRVPORT 23251 #define SRVADDR "130.207.8.20" #define REQUEST 0 typedef struct hw8Msg { u_long cookie; /* random number identifying packet */ u_long uSSN; /* Social Security Number */ u_long request_reply; /* 0=request, non-zero=reply */ u_short outcome_result; /* outcome: 1 bit: 0=success, 1=error */ /* response: 15 bits; if outcome is 0 */ /* if outcome is 0, */ /* indicates pobox */ /* it outcome is 1, */ /* indicates error */ u_short checksum; /* Checksum for packet */ } HWMSG; /* These macros are used to set/read the Outcome and * Results parts of the outcome_res field. */ #define setOutcome(outcome_res, outcome) (outcome_res)|=((outcome&0x01)<<15) #define getOutcome(outcome_res) ((outcome_res>>15)&0x01) #define setResult(outcome_res, res) (outcome_res)|=(res&0x7fff) #define getResult(outcome_res) (outcome_res&0x7fff) /* Values returned by the server in the result portion of */ /* the outcome_res field. */ #define ERROR_CHECKSUM 1 /* request failed checksum */ #define ERROR_SYNTAX 2 /* request was malformed */ #define ERROR_UNKSSN 3 /* requested SSN not in database */ #define ERROR_SERVER 5 /* other server malfunction */