📄 new_ip.c
字号:
/* AUTHOR */
/* */
/* B. Harwell, Accelerated Technology */
/* */
/* HISTORY */
/* */
/* created - 12/21/92 */
/* */
/* CALLED FROM */
/* */
/* PROTINIT.C */
/* TCP.C */
/* SOCKETS.C */
/* TOOLS.C */
/* */
/* ROUTINES CALLED */
/* */
/* N/A */
/* */
/* INPUTS */
/* */
/* number long number to be byte swapped */
/* */
/* OUTPUTS */
/* */
/* return_value the input value after being byteswapped*/
/* */
/************************************************************************/
uint32 longswap(uint32 number)
{
#ifdef SWAPPING
uint8 *new, *org;
uint32 return_value = 0;
org = (uint8 *)&number;
new = (uint8 *)&return_value;
/* swap the bytes one at time */
new[0] = org[3];
new[1] = org[2];
new[2] = org[1];
new[3] = org[0];
return(return_value);
#else
return(number);
#endif /* SWAPPING */
}
#endif /* !(LONGSWAP_ASM) */
#if !(INTSWAP_ASM)
/************************************************************************/
/* */
/* FUNCTION "intswap" */
/* */
/* */
/* DESCRIPTION */
/* */
/* This function swaps 2 bytes of a number. */
/* */
/* AUTHOR */
/* */
/* B. Harwell, Accelerated Technology */
/* */
/* HISTORY */
/* */
/* created - 12/21/92 */
/* */
/* CALLED FROM */
/* */
/* PROTINIT.C */
/* TCP.C */
/* SOCKETS.C */
/* NET.C */
/* UDP.C */
/* DNS.C */
/* IP.C */
/* USER.C */
/* ARP.C */
/* */
/* ROUTINES CALLED */
/* */
/* N/A */
/* */
/* INPUTS */
/* */
/* number number to be byte swapped */
/* */
/* OUTPUTS */
/* */
/* return_value the input value after being byteswapped*/
/* */
/************************************************************************/
uint16 intswap (uint16 number)
{
#ifdef SWAPPING
uint8 *new, *org;
uint16 return_value = 0;
org = (uint8 *)&number;
new = (uint8 *)&return_value;
/* swap the bytes in the int16 */
new[0] = org[1];
new[1] = org[0];
/* return_value = ((number & 0x00FF)<< 8);*/
/* return_value += ((number & 0xFF00)>> 8);*/
return(return_value);
#else
return (number);
#endif /* SWAPPING */
}
#endif /* !(INTSWAP_ASM) */
#if !(COMPAREN_ASM)
/************************************************************************/
/* */
/* FUNCTION "comparen" */
/* */
/* */
/* DESCRIPTION */
/* */
/* This function compares 2 strings for equality. */
/* */
/* AUTHOR */
/* */
/* B. Harwell, Accelerated Technology */
/* */
/* HISTORY */
/* */
/* created - 12/21/92 */
/* */
/* CALLED FROM */
/* */
/* IP.C */
/* ARP.C */
/* EQUEUE.C */
/* CONFILE.C */
/* UDP.C */
/* BOOTP.C */
/* PROTINIT.C */
/* TOOLS.C */
/* UTIL.C */
/* */
/* ROUTINES CALLED */
/* */
/* N/A */
/* */
/* INPUTS */
/* */
/* s1 Pointer to the first input string */
/* s2 Pointer to the second input string */
/* len Length of characters to compare */
/* */
/* OUTPUTS */
/* */
/* return_value Equality indicator : */
/* return 0 if strings 1 and 2 are not equal */
/* return 1 if strings 1 and 2 are equal */
/* */
/************************************************************************/
int16 comparen (VOID *s1, VOID *s2, int16 len)
{
return (!memcmp ((void *)s1, (void *)s2, (uint16)len));
}
#endif /* !(COMPAREN_ASM) */
int32 n_clicks()
{
#ifdef PLUS
UNSIGNED current_time;
current_time = NU_Retrieve_Clock();
#else
long current_time; /* TBV - I just changed this from int to long */
current_time = NU_Read_Time();
#endif
return ((long)current_time);
}
void init_time()
{
#ifdef PLUS
UNSIGNED t;
#else
long t;
#endif
#ifdef MSC
t = (uint32)time (NU_NULL);
#else
t = NU_TCP_Time ((uint32 *)NU_NULL);
#endif
#ifdef PLUS
NU_Set_Clock((UNSIGNED) (t & 0x7FFF));
#else
NU_Set_Time((unsigned int) (t & 0x7FFF));
#endif
} /* end init_time */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -