00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <stdio.h>
00030 #include <monitor.h>
00031 #include <nsnet.h>
00032
00033 int monitorLog(enum PlaceCode placeCode, int errNum)
00034 {
00035 char *descPlace;
00036 char buf[MAXLEN];
00037 sprintf(buf, "unknown error code: %d", errNum);
00038 switch (placeCode) {
00039 case PLACE_CONNECT: descPlace = "connect"; break;
00040 case PLACE_WRITEBYTES: descPlace = "writebytes"; break;
00041 case PLACE_MYREAD: descPlace = "myread"; break;
00042 case PLACE_SETBLOCKING: descPlace = "setblocking"; break;
00043 case PLACE_RRECV: descPlace = "rrecv"; break;
00044 case PLACE_RSELECT: descPlace = "rselect"; break;
00045 default:
00046 descPlace = buf;
00047 break;
00048 }
00049 fprintf(stdout, "Recieved error code %d from placeCode %d. errstr is %s and descPlace is %s\n", errNum, placeCode, stringifyErrorCode(errNum), descPlace);
00050 fflush(stdout);
00051 return 0;
00052 }
00053